Python program to check given number is even or odd
Our Logic to check given number is even or odd
- Our program will take a number as input from the user.
- The input number is checked if it is an even number or not.
- If it is, then print ‘even,’ and if it is not, the result should print ‘odd.’
[elementor-template id=”5253″]
#taking input from the user
num = int(input("Enter a number to check even/odd : "))
# num = 452
#if number is divisible by 2
if num%2 == 0:
print(num,"is even number")
else:
print(num,"is odd number")