C relation operator
C relation operator
int main()
5 {
6
7 int a = 25, b = 5;
8
9 // using operators and printing results
10 printf("a + b = %d\n", a + b);
11 printf("a - b = %d\n", a - b);
12 printf("a * b = %d\n", a * b);
13 printf("a / b = %d\n", a / b);
14 printf("a % b = %d\n", a % b);
15 printf("+a = %d\n", +a);
16 printf("-a = %d\n", -a);
17 printf("a++ = %d\n", a++);
18 printf("a-- = %d\n", a--);
19
20 return 0;
21 }
Output
a + b = 30
a - b = 20
a * b = 125
a / b = 5
a % b = 0
+a = 25
-a = -25
a++ = 25
a-- = 26
2. Relational Operators in C
The relational operators in C are used for the comparison of the two
operands. All these operators are binary operators that return true or
false values as the result of comparison.
https://www.geeksforgeeks.org/operators-in-c/ 4/27
1/26/25, 6:19 PM Operators in C - GeeksforGeeks
1 Returns true if
the left
operand is
< Less than a<b
less than the
right operand.
Else false
2 Returns true if
the left
operand is
> Greater than greater than a>b
the right
operand. Else
false
3 Returns true if
the left
operand is
Less than or
<= less than or a <= b
equal to
equal to the
right operand.
Else false
4 Returns true if
the left
operand is
>= Greater than
greater than a >= b
or equal to
or equal to
right operand.
Else false
5 Returns true if
== both the
Equal to a == b
operands are
equal.
https://www.geeksforgeeks.org/operators-in-c/ 5/27
1/26/25, 6:19 PM Operators in C - GeeksforGeeks
6 Returns true if
!= both the
Not equal to a != b
operands are
NOT equal.
Output
a < b : 0
a > b : 1
a <= b: 0
a >= b: 1
a == b: 0
a != b : 1