Write a C++ Program to Find whether given Number is Odd or Even.



Write a C++ Program to Find whether given Number is Odd or Even...

Answer / hr

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

Post New Answer

More C++ Interview Questions

Write a syntax and purpose of switch statement.

0 Answers   Agilent,


Write a program to display the following output using a single cout statement Maths=90 Physics=77 Chemistry = 69

2 Answers  


What is a COPY CONSTRUCTOR and when is it called?

0 Answers   IBS,


What is partial specialization or template specialization?

0 Answers   Amazon,


Write a program that ask for user input from 5 to 9 then calculate the average

0 Answers   IBS,






what is a pragma in C++?

0 Answers   Aspire,


What is an abstract class in C++

0 Answers   SwanSoft Technologies,


dynamic scoping is

0 Answers   Siemens,


What is Advantage and Use of THIS pointer in C++ – Scenarios?

0 Answers  


What kind of problems does name mangling cause?

0 Answers   Amazon,


What is Boyce Codd Normal form?

0 Answers   IBS,


Briefly explain various access specifiers in C++.

0 Answers   Amdocs,


Categories