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 |
Difference between function overloading and function overriding.
What are the costs and benefits of using exceptions?
What is RTTI and why do you need it?
How to input string in C++
What is Advantage and Use of THIS pointer in C++ – Scenarios?
Do you know about Agilent PRECOMPILERS. ?
C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.
Write a C++ Program to find Square Root of a number using sqrt() function.
Find the Factorial of a number using a program.
What is the difference between virtual functions and pure virtual functions?
Without using third variable write a code to swap two numbers.
What is an abstract class in C++
0 Answers SwanSoft Technologies,