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

what kind of projects are suitable for c and c++

840


Can you pass an array to a function in c++?

777


What is encapsulation in C++? Give an example.

845


State the difference between delete and delete[].

826


What are the advantages of using friend classes?

902


Is map thread safe c++?

876


Evaulate: 22%5 a) 2 b) 4 c) 0

883


Is linux written in c or c++?

810


What are constructors in oop?

813


Explain the difference between realloc() and free() in c++?

767


Can I uninstall microsoft c++ redistributable?

817


what are the decision making statements in C++? Explain if statement with an example?

885


Name the operators that cannot be overloaded in C++?

822


What is iomanip c++?

831


What is an inclusion guard?

877