CBSE Class 12 Computer Science Question 96 of 105

Python Revision Tour — Question 2

Back to all questions
2
Question

Question 2

Write a program that returns True if the input number is an even number, False otherwise.

Solution
x = int(input("Enter a number: "))

if x % 2 == 0:
    print("True")
else:
    print("False")
Output
Enter a number: 10
True

Enter a number: 5
False
Answer