C Program to Check Whether Number is Even or Odd Using Bitwise Operator
This C program checks whether a given number by user is even or odd using Bitwise Operator.
C Source Code: Even or Odd Using Bitwsie Operator
#include<stdio.h>
int main()
{
int number;
printf("Enter number: ");
scanf("%d", &number);
/* Checking Even or Odd */
if (number & 1)
{
printf("%d is Odd.", number);
}
else
{
printf("%d is Even.", number);
}
return 0;
}
Output
Run 1: --------------- Enter number: 11 11 is Odd. Run 2: --------------- Enter number: 24 24 is Even.