Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Python Program to Check Whether a Number is Even or Odd

Check a given number is Even or Odd​

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

This given number is even number, because number is divisible by 2.
Python Program to check whther a number is even or odd

Working:

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

Python Program:

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

# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student) 

Output:

Enter a Number: 5
Given number is Odd