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 C++ Program to Find whether given Number is Odd or Even.

1 Answers  


Discuss the role of C++ shorthands.

0 Answers   Adobe,


What is the difference between malloc, calloc and realloc?

0 Answers   Alter,


What kind of problems does name mangling cause?

0 Answers   Amazon,


Write a C++ Program to Find Sum and Average of three numbers.

1 Answers  


Can we use THIS Pointer in static function – Reason in C++?

0 Answers  


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

1 Answers  


What is placement new?

1 Answers   Amazon,


What is RTTI and why do you need it?

0 Answers   Amazon,


What is a COPY CONSTRUCTOR and when is it called?

0 Answers   IBS,


C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

0 Answers  


What is static variable and difference between(const char *p,char const *p,const char* const p).

0 Answers   Accenture,


Categories