// Armstrong Number Checking Program Using Class
#include <iostream>
using namespace std;
class arms
{
int a,t,rem,sum=0;
public:
void getdata();
void check();
};
void arms::getdata()
{
cout<<"\n amstrong Number Checking Program;"<<endl;
cout<<"\n Enter a Number : ";
cin>>a;
cout<<a<<endl;
}
void arms:: check()
{
t=a;
while(t!=0)
{
rem=t%10;
sum=sum+rem*rem*rem;
t=t/10;
}
if(sum==a)
{
cout<<"\n Given Number "<<a<<", is a ARMSTRONG Number."<<endl;
}
else
{
cout<<"\n Given Number "<<a<<", is not a ARMSTRONG Number."<<endl;
}
}
int main()
{
arms n;
n.getdata();
n.check();
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: