Practical - 59 - Write a program in Python to input a number and check whether it is even or odd.
Ans:
n=int(input("Enter a number: "))
if n%2==0:
print(n,"is an even number")
else:
print(n,"is an odd number")
Output:
Enter a number: 5
5 is an odd number
OR
Enter a number: 6
6 is an even number
No comments:
Post a Comment