Write a C program that demonstrates bitwise logical operators.
#include <stdio.h>
int main()
{
int a = 20;
int b = 21;
int c = 0;
c = a & b;
printf("AND - Value of c is %d\n", c );
c = a | b;
printf("OR - Value of c is %d\n", c );
c = a ^ b;
printf("Exclusive-OR - Value of c is %d\n", c );
return 0;
}
Output
AND - Value of c is 20
OR - Value of c is 21
Exclusive-OR - Value of c is 1