1.

Check whether the number is EVEN or ODD, without using any arithmetic or relational operators

Answer»

#include<stdio.h>INT MAIN(){ int x; PRINTF("Enter a number: "); scanf("%d", &x); (x&1)?printf("ODD"):printf("Even"); return 0;}

The bitwise and(&) operator can be used to quickly CHECK the number is odd or even.



Discussion

No Comment Found