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 are the types of container classes?

820


What is public, protected, private in c++?

882


When not to use object oriented programming?

779


What gives the current position of the put pointer?

758


What is problem with overriding functions?

787


What is constant keyword in C++? Illustrate its various uses.

769


Define pure virtual function?

747


Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?

797


What are objects in oop?

827


Write a program which uses Command Line Arguments

858


Does there exist any other function which can be used to convert an integer or a float to a string?

840


Write a c++ program to display pass and fail for three student using static member function

3087


What is cin clear () in c++?

863


Why is encapsulation used?

767


What is difference between c++ and c ++ 14?

782