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 |
What are the advantages and disadvantages of B-star trees over Binary trees?
What do you by Function Overloading in C++?
0 Answers Akamai Technologies, Infogain,
What is partial specialization or template specialization?
What does it mean to take the address of a reference?
What are string library functions(syntax).
What Is A Default Constructor in C++ ?
What is the difference between member functions and static member functions?
What are the costs and benefits of using exceptions?
How to reverse a string in C++
How do you write a function that can reverse a linked-list in C++?
Identify the errors in the following program. #include <iostream> using namespace std; void main() { int i=5; while(i) { switch(i) { default: case 4: case 5: break; case 1: continue; case 2: case 3: break; } i-; } }
Consider the following C++ program