A program to explain logical operators
C Programming Language 014
The following code shows how to write a program to explain logical operators
Program
#include <stdio.h>
void main()
{
int a, b, c;
printf("Enter a, b values: ");
scanf("%d %d", &a, &b);
c = ((a < b) && (a > b));
printf("AND: %d\n", c);
c = ((a < b) || (a > b));
printf("OR: %d\n", c);
c = !(a == b);
printf("NOT: %d\n", c);
printf("\n");
}
Result
Enter a, b values: 5 8
AND: 0
OR: 1
NOT: 1
Last Updated on
Comments