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
Why multiple inheritance is not possible?
Why cstdlib is used in c++?
Which c++ operator cannot overload?
What is the difference between a type-specific template friend class and a general template friend class?
What are different types of loops in c++?
What is implicit pointer in c++?
What is object and class in oops?
What is rvalue?
Explain virtual class?
Why can’t you call invariants() as the first line of your constructor?
What language is a dll written in?
What are libraries in c++?
Describe the process of creation and destruction of a derived class object?
What is the main purpose of overloading operators?
Can a constructor return a value?