Check Whether the Number is Even or Odd in C++

0 Suresh Chand March 28, 2021

In this example, We will check whether number is even or odd.

To check whether number is even or odd, We will divide number by 2. If it gives remender 0 then that number is even otherwise that number is odd.

Let’s look an example to make clear concepts

using namespace std;

int main()
    int num;

    cout << "Enter a Number: ";
    cin >> num;

    if( num % 2 == 0 )
        cout<<"\nIt is an Even Number." << endl;
        cout<<"\nIt is an Odd Number." << endl;

    return 0;

The output of above program is

Enter a Number : 10
It is an Even Number

Enter a Number : 11
It is an Odd Number
Notify of
Inline Feedbacks
View all comments

Join Our Newsletter Now

Get the latest tutorials, examples and projects updates.



Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Disable Ad Block

Want Same System