Skip to main content

How to Check a given number is Even or Odd ​in python

 

 How to Check a given number is Even or Odd in python​:-

 

In this Python program, we will be finding whether a number is even or odd. Even numbers are those positive natural numbers that are evenly divisible by 2 and Odd number is just the opposite, which is not evenly divisible by 2. If a number is even then it should return a remainder is 0 when the number is divided by 2 and if it is not equal to 0, then it is an Odd Number.

ALGORITHMS:-

Step 1. Start

Step 2. Insert a number.

Step 3. If the given number is divisible by 2, it prints,” Given number is even”.

Step 4. If the given number is not divisible by 2, it prints,” Given number is odd”.

Step 5. Stop

CODE: -


num = int(input("Enter a Number:"))
if num % 2 == 0:
    print("Given number is Even")
else:
    print("Given number is Odd")


OUTPUT:-





FOLLOW AND SUBSCRIBE TO THIS WEBPAGE FOR MORE NEW PROGRAMS AND CODING SOLUTIONS.

πŸ’¬πŸ’¬πŸ’¬πŸ’¬πŸ’—πŸ’—πŸ’—πŸ’—

Comments