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;
}
Comments
Post a Comment