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 the use of :: operator in c++?
Which is better turbo c++ or dev c++?
What is exception handling? Does c++ support exception handling?
Please explain the reference variable in c++?
Why is c++ not purely object oriented?
Is empty stack c++?
What does sksksk mean in text slang?
What is basic concept of oop?
Is there a c++ certification?
Why is the function main() special?
Explain what happens when an exception is thrown in C++.
What is an advantage of polymorphism?
What is the difference between new() and malloc()?
How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?
What is c++ prototype?