Program to understand the use of relational operators | Relational operators in C | Examples of Relational operators

Spread the love

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 Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply