even or odd number c++ || class program

even or odd number class program:

In this program find the entered number is Even number or Odd number. Which number is divisible by 2 is known as an even number, and which number is not divisible by 2 is known as an odd number.

Program:

#include<iostream>
using namespace std;
class even
{
int n,i;
public:
void read();
void print();
};
void even::read()
{
cout<<"enter the numbern";
cin>>n;
}
void even::print()
{
if(n%2==0)
{
cout<<"even numbern";
}
else
{
cout<<"odd numbern";
}
}
int main()
{
even ob1;
ob1.read();
ob1.print();
}

Output:

Click Here for Executable CPP file:

Recommended Posts:

0 thoughts on “even or odd number c++ || class program”

Leave a Comment