Python Program to Check if a Number is Odd or Even

In this example, we will write a simple program to take input number from the user and display if it is either odd or even number. To better understand this example, make sure you have knowledge of the following tutorials:-

Python Program to Check if a Number is Odd or Even using modulus operator:

The output of the above program is:-

Enter the number: 4
The number is Even

Python Program to Check if a Number is Odd or Even bitwise operator:

The output of the above program is:-

Enter the number: 5
The number is Odd
Here the bitwise operator checks the value in every bit and to know if it is odd, the last value of binary bit should be 1 i.e. 3 = 11 or 5 = 101.
SHARE Python Program to Check if a Number is Odd or Even

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Share