Dremendo Tag Line

Check a number is even or odd in Python

if else - Question 1

In this question, we will see how to check if a number is an even or odd number in Python programming using the if else statement. To know more about if else statement click on the if else statement lesson.

Q1) Write a program in Python to input a number and check it is an even or odd number. An even number is a number which is divisible by 2 and odd number is a number which is not divisible by 2.


n=int(input('Enter a number '))

if n%2==0:
    print('Even Number')
    print('Odd Number')


Enter a number 18
Even Number