Write a C++ Program to Find whether given Number is Odd or Even.
Answer Posted / hr
Solution:
/* 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<<"
The Entered Number [ "<<a<<" ] is EVEN Number.
";
}
else
{
cout<<"
The Entered Number [ "<<a<<" ] is ODD Number.
";
}
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
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a template in c++?
How many static variables are created if you put one static member into a template class definition?
How do you generate a random number in c++?
Define vptr.
What are features of c++?
Explain deep copy?
Explain about Garbage Collector?
Can we change the basic meaning of an operator in c++?
What is public, protected, private in c++?
What are the effects after calling the delete this operator ?
What is a .h file c++?
What is data abstraction? How is it implemented in C++?
What are arrays c++?
Explain polymorphism?
What is the point of polymorphism?