Hii LNJPITians
Here is some interesting code for you to finding even and odd no. We all have done that before using % (remainder or modulus) and if-else condition. But this time it's different. One of us written code in some interesting way using bitwise and logical operator. I appreciate Kumar Shubham, who submitted this code to us. Keep coding...
#include<stdio.h>
#include<conio.h>
int main()
{
int num;
printf("Enter a no: \n");
scanf("%d",&num);
(num & 1 && printf("odd"))||printf("even");
return 0;
getch();
}
Comments
Post a Comment