Program to find out of a number is odd or even using bitwise AND in C

#include <stdio. h>
int main()
{ 
int x;
   printf(“Enter the number: \n”) ;
   scanf(“%d”,&x) ;
if(x&1)
       printf(“\nThe number is odd. \n”) ;
else
       printf(“\nThe number is even. \n”) ;
return 0;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.