C Program : to expalin about Logical Operator's

Write a C Program to explain about Logical Operators?



 /* This program explains about the logical operators */

 #include < stdio.h >
  main()
   {
 
     int a, b, c, d;
     printf("Enter four integer values : ");
     scanf("%d %d %d %d", &a, &b, &c, &d);
     printf("Logical AND : %d < %d && %d >= %d is %d \n", a, b, c, d, a < b && c >= d);
     printf("Logical OR  : %d != %d || %d > %d is %d \n", a, b, c, d, a != b && c > d);
     printf("Logical NOT  : !(%d == %d) is %d \n", a, b, !(a == b));     
   }


Input : Enter four integer values : 1 2 3 4
Output :
Logical AND : 1 < 2 && 3 >= 4 is 0
Logical OR : 1 !=2 || 3 > 4 is 1
Logical NOT : !(1 == 2) is 1

Post a Comment

0 Comments