#include<iostream.h>
#include<conio.h>
class ams
{
int a,b,c,n;
public:
void create();
void process();
void output();
};
void ams::create()
{
cout<<"enter the no:";
cin>>n;
}
void ams::process()
{
b=n;
c=0;
while(n>0)
{
a=n%10;
c=c+(a*a*a);
n=n/10;
}}
void ams::output()
{
if(b==c)
{
cout<<"The number "<<b<<" is Amstrong";
}
else
{
cout<<"The number "<<b<<" is Not Amstrong";
}}
void main()
{
clrscr();
ams d;
d.create();
d.process();
d.output();
getch();
}
No comments: