Exercise 5 

Write a program in Python language that asks the user to enter their integer number and to display it if this number is even or odd

Solution:

# Ask to type value of n
n = input("Type value of the integer n : ")
# Convert n to int
n = int(n)
# Try if n is evn
if(n%2 == 0):
print("The integer n typed is even ")
else:
print("The integer n typed is old ")
Younes Derfoufi

Leave a Reply