F How to check Odd Even number in Python? | CodeTheta

How to check Odd Even number in Python?

June 11, 2018

Calculate with predefined value.
Code :
num = 37
if (num % 2 == 0):
    print ("even number")
else:
    print ("odd number")

Output : 
odd number

Value given during program execution.
Code :
num = int (input("Enter any integer number: "))
if (num % 2 == 0):
    print ("You have entered even number")
else:
    print ("You have entered odd number")

Output : 
Enter any integer number: 41
You have entered odd number

IDE Used To Test This Code : Python IDLE.

 Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment