C++ Program to Find Number is Even or Odd

C++ Program to find number is even or odd. By using this program we can check the number is odd or even using the c++ programming language for beginners.

#include <iostream>
using namespace std;
int main()
int n;
cout << "Enter the number";
cin >> n;
if ( n % 2 == 0)
cout << n << " is even";
cout << n << " is odd";
return 0;



Enter the number


45 is odd

Odd Number in C++

Odd numbers are integers that, when divided by two, always leave a residue. 

These are integers of the type n = 2k + 1, where k is a positive integer. -5, -3, -1, 1, 3, 5, 7, and so on are examples of odd numbers.

Even Number in C++

A whole number that may be split into two equal whole numbers by two. Even numbers are zero, two, four, six, and eight.

If Else Statement in C++

The conditional statements in C++ are as follows: If a particular condition is true, use if to specify a block of code to be run.

If the same condition is false, use otherwise to define a block of code to run. If the initial condition is false, use else if to provide a new condition to test.

% or Modulo Operator in C++

The modulus operator (‘ percent ‘) is a built-in technique in the C and C++ languages that computes the remaining after completing integer division. 

You may also use the modulus operator to determine if an integer is odd or even. You can do so by asking for the remains of a number after it has been divided by two.