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
1 Like
Related Questions
Explain the use of break statement in Python with the help of an example.
Write a program to find the smallest number among three numbers by using the nested 'if-else' statements.
Write a Python program to add all the elements of a tuple.
Write a program to delete/remove all the numbers less than 10 from the list.