Video courses for company/skill based Preparation
Purchase mock tests for company/skill building
Python Program to Check Whether a Number is Even or Odd
Check a given number is Even or Odd
Number is 46
This given number is even number, because number is divisible by 2.
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
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)
Enter a Number: 5
Given number is Odd