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
What are the types of container classes?
What is public, protected, private in c++?
When not to use object oriented programming?
What gives the current position of the put pointer?
What is problem with overriding functions?
What is constant keyword in C++? Illustrate its various uses.
Define pure virtual function?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
What are objects in oop?
Write a program which uses Command Line Arguments
Does there exist any other function which can be used to convert an integer or a float to a string?
Write a c++ program to display pass and fail for three student using static member function
What is cin clear () in c++?
Why is encapsulation used?
What is difference between c++ and c ++ 14?