Write a C++ Program to Find whether given Number is Odd or Even.



Write a C++ Program to Find whether given Number is Odd or Even...

Answer / 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

More C++ Interview Questions

Explain what happens when an exception is thrown in C++.

0 Answers   Amazon,


What is a memory leak in C++?

0 Answers   Agilent,


Briefly explain various access specifiers in C++.

0 Answers   Amdocs,


Define type casting in C++.

0 Answers   Amdocs,


Write a program to read two numbers from the keyboard and display the larger value on the screen

1 Answers  






What are Agilent PRECOMPILERS?

0 Answers   Agilent,


What is wrong with this statement? std::auto_ptr ptr(new char[10]);

0 Answers   Amazon,


What is constant keyword in C++? Illustrate its various uses.

0 Answers   Akamai Technologies, Infogain,


What's the value of the expression 5["abxdef"]?

0 Answers  


What is the difference between public, private, and protected inheritance?

0 Answers   Amazon,


When would you use a pointer? A reference?

0 Answers   Amazon,


What is the difference between virtual functions and pure virtual functions?

1 Answers  


Categories