## Introduction

Numbers are very useful and essential in the world we live in, especially in mathematics and computer science.

Even and Odd numbers are great numerical concepts to have under number theory. In this note i am going to explain the characteristics of this two types numbers.

## Even Numbers

One of the characteristics of an even number is that **it has to be an integer**, which simply means that is a whole number *(not a fractional number)* that can be positive, negative, or zero. Once you have an integer it has to be fully divisible by* 2*, this means that when we divide any given number *(K)* we should not get a remainder. This two characteristics make up an even number. So we can simply put the formula as follows:

*K*(*any number*) – has to be an integer.- when
*K*is divided by*2*we should not get any remainder.

For example when we divide *K(5)* by 2 we get a remainder of *1*, of which it disqualifies it as an even number. But when we divide *K(8)* by 2 we get no remainder* (0)*. This can be express this in programming as follows:

**Language used: C++**

```
int Number;// Declare the variable as an integer to get back an integer result.
cin >> Number;
Number = Number%2; // checking if the number has a remainder.
if (Number==0)
{
cout << "Even Number"; // Displayed if the number is even
}
else
{
cout << "Not even number"; // Displayed if the number is not even
}
```

## Odd Numbers

Odd numbers a different characteristic than that of an even number. Odd numbers must be integers just like even numbers but when they are divided by 2 they return a reminder.

Odd numbers can be defined by this formula:

- They have to be integers
- When they are divided by
*2*they return a reminder

For example *K(5)*÷*2* it returns a reminder of 1 of which it makes it an odd number. This can be expressed making the equal to zero expression `Number==0`

to be not equal to zero `Number!=0`

```
int Number;// Declare the variable as an integer to get back an integer result.
cin >> Number;
Number = Number%2; // checking if the number has a remainder.
if (Number!=0)
{
cout << "Odd Number"; // Displayed if the number is even
}
else
{
cout << "Not Odd number"; // Displayed if the number is not even
}
```

## Even and Odd Number Generator

In order to generate this numbers you can use this formula:

**Addition and subtraction**

even ± even (2± 2)= even

even ± odd (2± 3) = odd

odd ± odd (5± 5) = even

**Multiplication**

even × even (2 x 2) = even

even × odd (2 x 3)= even

odd × odd (5 x 5) = odd

Even numbers generation can also be expressed with this formula *2.K * (*2 x 7 = 14*) where *K* is an integer. So you take any number *K* and multiply it by *2* you will always get an even number.

You can put this in a program as follows.

```
int EvenGenerator ()
{
int StartLimit, MaxLimit, Result;
cout << "Enter the starting Number: "; cin >> StartLimit;
cout << "Enter Maximum Number"; cin >> MaxLimit;
for (int i = 0; i<MaxLimit; ++i)
{
if (StartLimit < MaxLimit)
{
StartLimit = 2*StartLimit;
cout << StartLimit <<endl;
}
else
{
break;
}
}
}
```

Odd number generation can be expressed using this formula: *2.K+1 where K is any integer (*2×7 = 14+1= 15*). *This can be put on a program as follows.

```
int OddGenerator ()
{
int StartPoint,EndPoint;
cout << "Enter Start point: "; cin >> StartPoint;
cout << "Enter End point: "; cin >> EndPoint;
for (int i = 0; i < EndPoint; ++i )
{
if (i<=EndPoint)
{
StartPoint = (2*StartPoint)+1;
cout << StartPoint <<endl; } if (StartPoint>=EndPoint)
{
break;
}
}
}
```