C++ Program to determine whether a number is even or odd

Friends , Today I am going to publish a Simple program to find whether a number is even or odd.

Hello Cyber Astronauts,
In this article I will tell you How to write a program that determines whether a number is odd or even.

First we need to know,

Integers which are perfectly divisible by 2 are called even numbers. And those integers which are not perfectly divisible by 2 are not known as odd number. To check whether an integer is even or odd, the remainder is calculated when it is divided by 2 using modulus operator %. If remainder is zero, that integer is even if not that integer is odd.

In this program, if..else statement is used to check whether n%2 == 0 is true or not. If this expression is true, n is even if not n is odd.

void main()
{  clrscr();
int n;
cout<<"Enter any number :";
cout<<"The number "<<n<<" is even ";
cout<<"The number "<<n<<" is odd :";



If got stuck in any problem, feel free to comment below.

Bookmark us for future posts.
Tested in turbo c++
Thanks for visiting .

About Author:

Hey Cyber Astronauts, Welcome to the one of best blog The CyberSpace HUB. I'm Himanshu Singh, a Part-time-blogger from India. Here at The CyberSpace HUB I write about Starting and managing a blog,Latest technology and Making Money online.

Join Me: Twitter | Facebook | Google Plus