# Python program to check given number is even or odd

In this tutorial, we are going to learn a python program to find a number given as input from the user is even or odd.

## Problem Statement

For any number that is input by the user, we have to check if it is even or odd.

For example:

Case1: If the user inputs number 51

then the output should be ‘odd’.

Case2: If the user inputs a number 100.

then the output should be ‘even’.

## How to check if a number is an even number?

An integer divided by ‘2’ and leaves the remainder 0 is called an even number. We can also define an even number as a number that ends with either 0 or 2 or 4 or 6 or 8 is considered an even number.

All the numbers other than even number is considered odd number. Odd numbers always leave the remainder ‘1’ when divided by ‘2’.

Our program divides the number by ‘2’. If the remainder is ‘0’, we consider a number an even number; otherwise, it is an odd number.

## Our Logic to check given number is even or odd

• Our program will take a number as input from the user.
• The input number is checked if it is an even number or not.
• If it is, then print ‘even,’ and if it is not, the result should print ‘odd.’

## Algorithm to check given number is even or odd

Step 1: Start

Step 2: take input from the user.

Step 3: if number is divisible by 2:

Print ‘even’

else:

Print ‘odd’

Step 4: Stop

## Python Code to check given number is even or odd

Output 1:

Explanation:

The input integer is 5, which is then checked if it’s divisible by 2.

5%2 = 1, which is not divisible by 2, this makes the integer 5 an odd integer

Output 2:

Explanation:

The input integer is 10, which is then checked if it’s divisible by 2.

10%2 = 0, which is divisible by 2, this makes the integer 10 an even integer.