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 |
How to run C++ program in cmd
How will you print a list of all unique words from a string which may contain repeated words?
write a program To generate the Fibonacci Series.
Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70
How to reverse a string in C++
Tell How To Check Whether A Linked List Is Circular ?
Discuss the role of C++ shorthands.
How many times will this loop execute? Explain your answer.
What are the advantages/disadvantages of using inline and const?
What is function overloading and operator overloading in C++?
Is deconstructor overloading possible? If yes then explain and if no Then why?
What is a COPY CONSTRUCTOR and when is it called?