Question.
Write a Python program that takes an integer as input from the user and checks whether the number is even or odd.
Instructions:
- 1. Take an integer input from the user using
input(). - 2. Use the modulus operator
%to check if the number is divisible by 2. - 3. Print Even if divisible by 2, otherwise print Odd.
Sample Test Cases:
- 1. Input: 7 → Output: Odd
- 2. Input: 10 → Output: Even
Solution:
Code Example
# Program - Even or Odd
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")