C program to demonstrate the working of relational operators
// C program to demonstrate the working of relational operators:-
 
                                                                               
 
                                                                               
 
                                                                               
 
                                                                                 
                                                                               
 
                                                                               
 
                         
                                                       
                                                                               
 
#include <stdio.h>
#include<conio.h>
void main()
{
 int a,b;
 clrscr();
 printf("Enter
two integer numbers A and B:\n");
 scanf("%d%d",&a,&b);
 printf("A=%d and
B=%d:\n",a,b);
    if(a > b)
      {
      printf("A
is greater than B: \n(%d>%d)\n",a,b);
      }
    else
      {
      printf("A
is less than or equal to B: \n(%d<=%d)\n",a,b);
      }
    if(a >= b)
      {
      printf("A
is greater than or equal to B: \n(%d>=%d)\n",a,b);
      }
    else
      {
      printf("A
is less than B: \n(%d<%d)\n",a,b);
      }
    if(a < b)
      {
      printf("A
is less than B: \n(%d<%d)\n",a,b);
      }
    else
      {
      printf("A
is greater than or equal to B: \n(%d>=%d)\n",a,b);
      }
    if(a <= b)
      {
      printf("A
is less than or equal to B: \n(%d<=%d)\n",a,b);
      }
    else
      {
      printf("A
is greater than B: \n(%d>%d)\n",a,b);
      }
    if(a == b)
      {
      printf("A
is equal to B: \n(%d==%d)\n",a,b);
      }
    else
      {
      printf("A
and B are not equal: \n(%d!=%d)\n",a,b);
      }
    if(a != b)
      {
      printf("A
is not equal to B: \n(%d!=%d)\n",a,b);
      }
    else
      {
      printf("A
is equal to B: \n(%d==%d)\n",a,b);
      }
    getch();
}
==============================
OUTPUT:-
Enter two integer numbers A and B:
2 6                                                                            
A=2 and B=6:                                                                   
A is less than or equal to B:                                                  
(2<=6)                                                                         
A is less than B:                                                              
(2<6)                                                                          
A is less than B:                                                              
(2<6)                    
                                                      
A is less than or equal to B:                                                  
(2<=6)                                                                         
A and B are not equal:                                                          
(2!=6)                                                                         
A is not equal to B:                                                           
(2!=6)                                                                          
=============================                                                                            
Comments
Post a Comment