Relational Operators in C Programming

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.
Example: Write a C Program to find the largest of two numbers.
#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

  Biggest of the two number is =  20