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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How do pointers work?

709


What is static class data?

579


What are register variables?

650


Explain stack & heap objects?

636


If you want to share several functions or variables in several files maitaining the consistency how would you share it?

555






How do you add an element to a set in c++?

553


Which operations are permitted on pointers?

570


What is the last index number in an array of 100 characters a) 100 b) 99 c) 101

592


Why c++ is so important?

613


What is meant by iomanip in c++?

612


What is the difference between a type-specific template friend class and a general template friend class?

564


Why is "using namespace std;" considered bad practice?

656


What is runtime polymorphism in c++?

595


Which is most difficult programming language?

584


What are vectors used for in c++?

628