write a simple program to accept a value from the user and display whether it is even or odd
Answers
Answered by
0
Explanation:
If you divide a number by 2 and it gives a remainder of 0 then it is known as even number, otherwise an odd number.
Even number examples: 2, 4, 6, 8, 10, etc.
Odd number examples:1, 3, 5, 7, 9 etc.
See this example:
num = int(input("Enter a number: "))
if (num % 2) == 0:
print("{0} is Even number".format(num))
else:
print("{0} is Odd number".format(num)
Attachments:
Similar questions
Science,
3 months ago
Art,
3 months ago
CBSE BOARD X,
3 months ago
Art,
7 months ago
Environmental Sciences,
7 months ago
History,
11 months ago
Political Science,
11 months ago
Math,
11 months ago