Posts

Showing posts from September, 2022

if else if loop C (with and gate &&)

#include<stdio.h> #include<conio.h> int main() {     int a;     printf("Enter a number");     scanf("%d",&a);     if(a%5==0 && a>20)     {         printf("%d is multiple of 5 & greater than 20",a);     }     else if(a%5!=0 && a>20)     {         printf("%d is not multiple of 5 but greater than 20",a);     }     else if(a%5==0 && a<20)     {         printf("%d is a multiple of 5 but less than 20",a);     }     else      {         printf("%d is neither a multiple of 5 nor greater than 20",a);     }     getch();     return 0; }    

Sum of two numbers in C

#include <stdio.h> int main() {     int first,second,sum;     printf("Enter first number:");     scanf("%d",&first);     printf("Enter second number:");     scanf("%d",&second);     sum=first+second;     printf("Sum = %d",sum);     return 0; }