Write a C++ Program to Find whether given Number is Odd or Even. Here’s simple Program to Find whether given Number is Odd or Even in C++ Programming Language.
For example if user enters an odd number like 5 then the output will be Odd number and if user enters even number like 8 then output will be Even number.
Here is source code of the C++ Program to Find whether given Number is Odd or Even. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
/* C++ Program to Find whether given Number is Odd or Even */
#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter any positive number :: ";
cin>>a;
if(a%2==0)
{
cout<<"\nThe Entered Number [ "<<a<<" ] is EVEN Number.\n";
}
else
{
cout<<"\nThe Entered Number [ "<<a<<" ] is ODD Number.\n";
}
return 0;
}
Output : :
/* C++ Program to Find whether given Number is Odd or Even */
Enter any positive number :: 1327
The Entered Number [ 1327 ] is ODD Number.
Process returned 0
Above is the source code for C++ Program to Find whether given Number is Odd or Even which is successfully compiled and run on Windows System.The Output of the program is shown above .
For example if user enters an odd number like 5 then the output will be Odd number and if user enters even number like 8 then output will be Even number.
Here is source code of the C++ Program to Find whether given Number is Odd or Even. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
Output : :
Above is the source code for C++ Program to Find whether given Number is Odd or Even which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer