Relational Operators example in C Language

Relational Operators example Program :

  1. #include<stdio.h>
  2. int main(void)
  3. {
  4.         int a,;
  5.         printf(“Enter values for a and b : “);
  6.         scanf(“%d%d”,&a,&b);
  7.  
  8.         if(a<b)                
  9.                 printf(“%d is less than %dn,a,b);
  10.         if(a<=b)
  11.                 printf(“%d is less than or equal to %dn,a,b);
  12.         if(a==b)
  13.                 printf(“%d is equal to %dn,a,b);
  14.         if(a!=b)
  15.                 printf(“%d is not equal to %dn,a,b);
  16.         if(a>b)
  17.                 printf(“%d is greater than %dn,a,b);
  18.         if(a>=b)
  19.                 printf(“%d is greater than or equal to %dn,a,b);
  20.         return 0;
  21. }

Output :

Enter values for a and b : 20 10
20 is not equal to 10
20 is greater than 10
20 is greater than or equal to 10

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply