Introduction: In this article i have written a program to check whether the entered number is even number or the odd number using C++ language.
In previous article i explained How to swap two numbers without using temporary variable and Check whether a number is positive or negative using if else and How to find greatest of three numbers using multiple if statement and What is For loop in C++ Language? Example program to print counting up to given limit and What is goto statement,its advantages and disadvantages with program example and Get number of days in month,year using nested if and Program to check for vowel or consonant using switch case and many other C++ programs.
Implementation: Concept is very simple. Let's check it out with an example program.
First Run:
Second Run:
In previous article i explained How to swap two numbers without using temporary variable and Check whether a number is positive or negative using if else and How to find greatest of three numbers using multiple if statement and What is For loop in C++ Language? Example program to print counting up to given limit and What is goto statement,its advantages and disadvantages with program example and Get number of days in month,year using nested if and Program to check for vowel or consonant using switch case and many other C++ programs.
Implementation: Concept is very simple. Let's check it out with an example program.
#include<conio.h>
#include<iostream.h>
main()
{
cout<<"Enter any number: ";
cin>>num;
if(num%2==0)
cout<<num<<" is
even number";
else
cout<<num<<" is
odd number";
getch();
}
- Now run the program using Ctrl+F9
Output:
First Run:
Enter any number: 89
89 is odd number
Second Run:
Enter any number: 20
20 is even number
Now over to you:
"If you like my work; you can appreciate by leaving your comments,
hitting Facebook like button, following on Google+, Twitter, Linked in and
Pinterest, stumbling my posts on stumble upon and subscribing for receiving
free updates directly to your inbox . Stay tuned and stay connected for more
technical updates."
If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..