C Language has a following relational operators. For example: Assume variable A holds 100 and variable B holds 200 then −
Operator | Description | Example |
---|---|---|
== | Equals to | (A == B) is not true. |
!= | Not equal | (A != B) is true. |
> | Greater than | (A > B) is not true. |
< | Less than | (A < B) is true. |
>= | Greater than or equals to | (A >= B) is not true. |
<= | Less than or equals to | (A <= B) is true. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include < stdio.h > int main() { int a, b, big; a = 10; b = 20; if (a > b) // if condition is true move inside if-statement { big = a; } else { big = b; } printf("Biggest of the two number is = %d", big); return 0; } |
Output
1 | Biggest of the two number is = 20 |