Write a C++ Program to Find whether given Number is Odd or Even.
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 |
Explain what happens when an exception is thrown in C++.
What is a memory leak in C++?
Briefly explain various access specifiers in C++.
Define type casting in C++.
Write a program to read two numbers from the keyboard and display the larger value on the screen
What are Agilent PRECOMPILERS?
What is wrong with this statement? std::auto_ptr ptr(new char[10]);
What is constant keyword in C++? Illustrate its various uses.
0 Answers Akamai Technologies, Infogain,
What's the value of the expression 5["abxdef"]?
What is the difference between public, private, and protected inheritance?
When would you use a pointer? A reference?
What is the difference between virtual functions and pure virtual functions?