Sunday, December 6, 2009
EVEN OR ODD
,
Author: Raviteja
|
Filed Under:
c++
|
#include "iostream.h"
#include "conio.h"
class eo
{
private:
int n;
public:
void accept ()
{
cout << "Enter a number: ";
cin >> n;
}
void cal ();
};
void eo :: cal ()
{
switch (n)
{
case 0:
cout << "Number is zero";
break;
default:
switch (n%2)
{
case 0:
cout << "It is an Even number";
break;
default:
cout << "It is an Odd number";
}
}
}
void main ()
{
clrscr ();
eo E;
E.accept ();
E.cal ();
getch ();
}
Get the executable ( .exe ) file for this program..
Download
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment