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 |
Write a C++ Program to Reverse a Number using while loop.
Explain the FOR loop with a help of a code.
How to convert integer to string in C++
What is the difference between virtual functions and pure virtual functions?
What is an abstract class in C++
0 Answers SwanSoft Technologies,
Define namespace.
What does it mean to take the address of a reference?
What are pass by value and pass by reference?what is the disadvantage of pass by value?
What is the difference between realloc() and free() in C++?
Explain function prototypes in C++.
What kind of problems does name mangling cause?
Find the Factorial of a number using a program.