Relational operators in c

Relational operators are used to assigning values and comparing between two their both sides.it evaluates to 1 if the condition is true and 0 for if it is false.

Relation operators in c

we can compare numerical values but we cannot compare strings etc. because other operations have separate keywords to do these tasks (comparison tasks).

example:

//codeskulls #include

#include <stdio.h>
int main()
{
int a = 30, b = 20, c = 10;
printf("%d == %d = %d \n", a, b, a == b); // true
printf("%d == %d = %d \n", a, c, a == c); // false
printf("%d > %d = %d \n", a, b, a > b); //false
printf("%d > %d = %d \n", a, c, a > c); //false
printf("%d < %d = %d \n", a, b, a < b); //false
printf("%d < %d = %d \n", a, c, a < c); //true
printf("%d != %d = %d \n", a, b, a != b); //false
printf("%d != %d = %d \n", a, c, a != c); //true
printf("%d >= %d = %d \n", a, b, a >= b); //true
printf("%d >= %d = %d \n", a, c, a >= c); //false
printf("%d <= %d = %d \n", a, b, a <= b); //true
printf("%d <= %d = %d \n", a, c, a <= c); //true
return 0;
}

output:

30 == 20 = 0
30 == 10 = 0
30 > 20 = 1
30 > 10 = 1
30 < 20 = 0 30 < 10 = 0 30 != 20 = 1 30 != 10 = 1 30 >= 20 = 1
30 >= 10 = 1
30 <= 20 = 0
30 <= 10 = 0
Press any key to continue . . .