APC-SPS-007.c (312B)
1 /* WAP to check a number is even or odd using bitwise operator */ 2 3 #include<stdio.h> 4 int main() { 5 int x, res = 1; 6 printf("Enter a number : "); 7 scanf("%d", &x); 8 res = res & x; 9 if (res == 0) { 10 printf("\nInput %d is a even number.", x); 11 } 12 else { 13 printf("\nInput %d is a odd number.", x); 14 } 15 return 0; 16 }