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
How do pointers work?
What is static class data?
What are register variables?
Explain stack & heap objects?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
How do you add an element to a set in c++?
Which operations are permitted on pointers?
What is the last index number in an array of 100 characters a) 100 b) 99 c) 101
Why c++ is so important?
What is meant by iomanip in c++?
What is the difference between a type-specific template friend class and a general template friend class?
Why is "using namespace std;" considered bad practice?
What is runtime polymorphism in c++?
Which is most difficult programming language?
What are vectors used for in c++?