### What is an Even Number?

An even number is an integer number which is exactly divisible by 2.

Example: 0, 6, 8, 46, 168

### What is an Odd Number?

An odd number is an integer which is not exactly divisible by 2.

Example: 1, 9, 13, 19, 51, 101

Now if you understood the definitions of Odd and Even Number properly you can easily come to a conclusion that if a number is exactly divisible by 2, then the number is considered as an even number else the number will be considered as an odd number. So now
lets see the Flowchart and Pseudocode for better understanding.

## Flowchart to Find Whether a Number is Even or Odd

## Pseudocode to Find Whether a Number is Even or Odd

READ number
remainder=number%2
IF remainder==0
WRITE "Even Number"
ELSE
WRITE "Odd Number"
ENDIF
The first step in the algorithm is taking a number as an input from User. Let's say user enters value 6. So 6 will be stored inside variable "number".

Now the next step in algorithm (i.e number%2==0), in this step (number%2) returns the remainder after dividing number by 2.

[**Note:** Here % is known as modulus, which is an operator that returns remainder value after division]

Now the next step (i.e. remainder==0) simply checks if the remainder value is equal to 0 or not.

So if the remainder is 0, then the number is said to be Even number else it is said to be an Odd Number.

If the User Inputs 6, then

number=6

Remainder=number%2

i.e Remainder=6%2

Remainder=0

As Remainder is **0**,
6 is an **Even **Number

#### C Program For Even or Odd:

#include
#include
int main() {
int num=54643;
/*enter any number */
printf ("enter a num : \n");
scanf("%d",&num);
if( num%2==0)
printf ("%d is a even",num );
else
{printf ("%d is a odd",num );
}
return 0;
}
#### Python Program to find if Number is Even or Odd:

num = int(input("Enter a number: "))
if (num % 2) == 0:
print("{0} is Even".format(num))
else:
print("{0} is Odd".format(num))
#### Java Program to check if a Number is Even or Odd:

import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner ss= new Scanner(System.in);
System.out.println("Enter the number you want to check");
int num=ss.nextInt();
if(num%2==0)
{
System.out.println("Entered number is EVEN");
}
else
{
System.out.println("Entered number is ODD");
}
}
}
Our Quiz prepared by Experts Helps you identify your knowledge in Algorithms. Everyone should atleast attempt this Quiz Once.