Relational Operator
Values of two variables can be compared using relational operator. In this way, when we compare between variables, if the value is true, then the value will return 1, if it is false, then the value will return 0.
Equal to(==):
Returns 1 if the values of the operands given on the right side and left side are equal. Otherwise it will return the value 0.
int main()
{
int x=5,y=10;
printf("value of (a==b)=%d",a==b);
return 0;
}
output:
0
Not equal to(!=):
int main()
{
int x=5,y=10;
printf("value of (a!=b)=%d",a!=b);
return 0;
}
output:
1
Less than(<):
Returns 1 if the value of the left operand is less than the value of the right operand, otherwise returns 0.
int main()
{
int x=5,y=10;
printf("value of (a
return 0;
}
output:
1
Less than or equal to(<=):
Returns 1 if the value of the left operand is less than (or equal to) the value of the right operand. Otherwise it will return the value 0.
int main()
{
int x=5,y=10;
printf("value of (a<=b)=%d",a<=b);
return 0;
}
output:
1
Greater Than(>):
Returns 1 if the value of the left operand is greater than the value of the right operand, otherwise returns 0.
int main()
{
int x=5,y=10;
printf("value of (a>b)=%d",a>b);
return 0;
}
output:
0
Greater than or equal to(>=):
int main()
{
int x=5,y=10;
printf("value of (a>=b)=%d",a>=b);
return 0;
}
output:
0