1 min read
Make a Python program to check wheater the given number is Even or Odd.
If a number is exactly divisible by 2 then it is an even number else it is an odd number. In this article, we will use this particular logic to create a Python program to find whether the number given by the user is Even or Odd.
To understand the program you need to have an understanding of following Python concepts.
num = int(input("Enter a number"))
if num == 0:
print("Enter a valid number")
elif(num % 2) == 0:
print(f"{num} is an even number")
else:
print(f"{num} is an odd number")
Enter a number 4
4 is an even number
PROGRAMS
Latest from djangocentral
2 min read
2 min read