Python Program to Check Whether Number is Even or Odd Using Bitwise Operator

This Python program checks whether a given number by user is even or odd using Bitwise Operator.

Python Source Code: Even or Odd Using Bitwsie Operator


# Check Even or Odd Using Bitwise Operator

number = int(input("Enter number: "))

if number & 1:
    print("ODD")
else:
    print("EVEN")

Output

Run 1:
---------------	
Enter number: 2
EVEN

Run 2:
---------------	
Enter number: 1171
ODD