KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Write a Python program to check that if a given number is even or odd.

Python Control Flow

1 Like

Answer

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

if num % 2 == 0:
    print("The number is even.")
else:
    print("The number is odd.")

Output

Enter a number: 82
The number is even.

Enter a number: 51
The number is odd.

Answered By

3 Likes


Related Questions