The relational operator is used to compare two values,for example compare two items price.thse comparisons can be done with the help of relational operators.the following list and explain the all relational operator in to details.
Sr.No |
Options |
Descriptions |
---|---|---|
01 |
< |
Is less than |
02 |
<= |
Is less than or equal to |
03 |
> |
Is greater than |
04 |
>= |
Is greater than or equal to |
05 |
== |
Is equal to |
06 |
!= |
Is not equal to |
This operator is used to compare value is less than or not,the following syntax and example.
Syntax
value1 < value2
Example
10 < 20
This operator is used to compare value is less than or eqal to,the following syntax and example.
Syntax
value1 <= value2
Example
10 <= 10
This operator is used to compare value is greater than or not,the following syntax and example.
Syntax
value1 > value2
Example
10 > 20
This operator is used to compare value is greater than or equal to,the following syntax and example.
Syntax
value1 >= value2
Example
10 >= 20
This operator is used to compare value is equal or not,the following syntax and example.
Syntax
value1 == value2
Example
10 == 10
This operator is used to check value Is not equal,the following syntax and example.
Syntax
value1 != value2
Example
10 != 20
#include
int main()
{
int a=20,b=10;
if (a == b)
{
printf("A and B are Equal");
}
else
{
printf("A and B are Not Equal");
}
}
A and B are Not Equal