24. Python Program to Check whether the given number is Even or Odd.
How does this program work?
- In this program you are going to learn about to check if a number is Even or Odd using Python.
- In this program odd and even A number is even if it is perfectly divisible by 2.
- When the number is divided by 2, we use the remainder operator % to compute the remainder.
- If the remainder is zero, the number is even else the number is odd.
Here is the code
a = int(input("Enter a number: "))
if a%2 == 0:
print("Number is Even")
else: print("Number is Odd")