Python program to find even odd numbers

To check given number even or odd, we need to divide that number with 2, if the remainder gives 0 it is even number other wise it odd number.

  • First take input number from user by input() method
  • Assign value to variable x
  • Now take module of the number by 2
  • check the remainder value, if it is '0' then the number is Even
  • Else if it is '1' then the number is Odd
x = int(input("Insert any number: "))

if x % 2 == 0:
    print("This is an EVEN number!")
else:
    print("This is an ODD number!")

 

Output:

Insert any number: 121
This is an ODD number!

 

Insert any number: 512
This is an EVEN number!

 

In this python program we ask user to enter a number, then convert given input to integer and then will check the number is even or odd.

Subscribe For Daily Updates