#include<iostream>
using namespace std;
class armstrong
{
int n,s,t,r;
public:
void get();
void check();
};
void armstrong::get()
{
cout<<"Enter a number:"<<endl;
cin>>n;
}
void armstrong::check()
{
t=n;
s=0;
while(n!=0)
{
r=n%10;
s+=r*r*r;
n=n/10;
}
if(s==t)
cout<<t<<" is a Armstrong number"<<endl;
else
cout<<t<<" is not a Armstrong number"<<endl;
}
int main()
{
armstrong a;
cout<<"CHECKING ARMSTRONG OR NOT:"<<endl;
a.get();
a.check();
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: