Problem Statement
In this challenge, you must find if the given number is an even number or odd number.
Input
The first line of input consists of an integer n
, where 0>=n
.
Output
Print even
if the given number is even number, or odd
if the given number is odd number.
As is
The boilerplate code is already there to read the input from user, in the main()
function. Do not edit this code.
To do ✍
printEvenOrOdd()
has one parameter: n
. Complete the function that prints if the given number is even or odd.
Example 1
Test input
5
Test output
odd
Explanation
Since given number is not exactly divisible by 2, given number is an odd number.
Example 2
Test input
12
Test output
even
Explanation
Since given number is exactly divisible by 2, given number is an even number.
Python Program
# Complete the following function
def printEvenOrOdd(n):
# Boilerplate code - Do not edit the following
def main():
n = int(input())
printEvenOrOdd(n)
if __name__ == "__main__":
main()
Input and Outputs 1
1
odd
Input and Outputs 2
5234
even
Input and Outputs 3
7
odd
# Complete the following function
def printEvenOrOdd(n):
if n % 2 == 0:
print('even')
else:
print('odd')
# Boilerplate code - Do not edit the following
def main():
n = int(input())
printEvenOrOdd(n)
if __name__ == "__main__":
main()