Expression |
Meaning |
a==b |
a is equal to b |
a!=b |
a is not equal to b |
a<=b |
a is less than equal to b |
a>=b |
a is greater than equal to b |
a<b |
a is less than b |
a>b |
a is greater than b |
a%b |
remainder of a÷b |
a/b |
quotient of a÷b |
|| |
or |
&& |
and |
Print wheather a number is even or odd.
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a;
scanf(“%d”,&a);
if (a%2==0)
{
printf(“%d is even”,a);
}
else
{
printf(“%d is odd”,a);
}
getch();
}
Print the greatest number among 3 given numbers.
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a,b,c;
scanf(“%d %d %d”,&a,&b,&c);
if(a>b && a>c)
{
printf(“%d is the greatest”,a);
}
else if(b>a && b>c)
{
printf(“%d is the greatest”,b);
}
else if(c>a && c>b)
{
printf(“%d is the greatest”,c);
}
getch();
}