So today we are going to write a Python program to check whether the given number is even or odd.
If number is completely divisible by 2 with remainder 0 then it is and even number otherwise the number is odd.
As you must be aware ” % ” modulus is used to find the remainder of any number.
For example: given number is 25
So 25 % 2 = 1 i.e. Remainder is 1 so number is odd otherwise if it would have been even.
Now let’s have a look at the python program.
Python program to check whether the given number is Even or Odd:
num = int(input("enter a number: ")) if(num%2 == 0): print("number is even") else: print("number is odd")
enter a number: 12 number is even