Write a Program to Check Whether a Number is Even or Odd

In Python Program, if you want to check that a number if even or odd. To do this, divide the number being tested into two equal halves; then count the number of numbers left over after dividing to test whether they are even or odd.

Python Program to Check Whether a Number is Even or Odd

If there is an equal amount of numbers as there are original numbers in both halves left over, then the number being tested is even!

Python Program How to check if a Number is Odd or Even

In this python program, we will learn how to check if a number is odd or even.

 

number = int(input(" Please Enter any Integer Value : "))
if(number % 2 == 0):
    print("{0} is an Even Number".format(number))
else:
    print("{0} is an Odd Number".format(number))

Within this python program we use if statement asks the user to Enter any integer value.

number = int(input(" Please Enter any Integer Value : "))

Here The output the python program odd or even.

 Please Enter any Integer Value : 4
4 is an Even Number

 Please Enter any Integer Value : 9
9 is an Odd Number

Leave a Comment

Exit mobile version