Python program to check if a number is odd or even

Python program to check if a number is odd or even

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

If a number is completely divisible by 2 then the number will be called Even. and if we got any reminder then the number will be called Odd.

So to obtain a reminder we use an operator ” % ” called modules. When we divide any number by % (modules) then we will get the reminder.

n = int( input(‘ Enter any number : ‘ ) )
if ( n % 2 == 0):
    print(‘{0} is Even Number’.format(n))
else:
    print(‘{0} is Odd Number’.format(n))

Output

Enter any number : 20
20 is Even Number
Again Run the program
Enter any number : 15
15 is Odd Number

If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *