Write a C Program to Check a Number Odd or Even using Bitwise Operator

July 11, 2022 0 Comments

In this tutorial learn how you can write a c program to check a number odd or even using bitwise operator. 

We are using & (AND) bitwise operator for this tutorial.

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.


write c program to check number odd or even using bitwise operator


Write a Program to Check a Number Odd or Even using Bitwise Operator

Here is the code to check a number odd or even using bitwise operator in C programming.

#include <stdio.h> //WAP to check  a number odd or even  using bitwise operator.
int main(){
int num;
printf("Please enter any number:");
scanf("%d",&num);
if((num&1)==1)
printf("%d is odd.",num);
else printf("%d is even.",num);
return 0;
}

Test Live At Jdoodle



Conclusion

This is how you can check a number odd or even using bitwise operator in c programming. Comment below if you like our tutorial.

Leave a comment

Gallery