#include <iostream>  
using namespace std;  
class Armstrong 
{
    int n,r,sum=0,temp; 
    public:
    void getdata();
    void calculations();
};
void Armstrong::getdata()
{
    cout<<"\nEnter the Number:";    
    cin>>n;
    cout<<n;
}
void Armstrong::calculations()
{
    temp=n;    
while(n>0)    
{    
r=n%10;    
sum=sum+(r*r*r);    
n=n/10;    
}    
if(temp==sum)    
cout<<"\nThe given number"<<temp<<" is Armstrong Number."<<endl;    
else    
cout<<"\nNot Armstrong Number."<<endl;   
}
int main()  
{  
  Armstrong x;
  cout <<"Check Armstrong or not"<<endl; 
  x.getdata();
  x.calculations();
return 0;  
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: