#include <iostream>
using namespace std; 
int main() {
    int n, r, temp, sum=0;
    cout <<"Enter the number "<<endl; 
    cin>>n; 
    temp =n; 
    while(n>0)
    {
        r=n%10;
        sum=sum+(r*r*r);
        n=n/10;
    }
    if (sum==temp)
    cout <<"The given number"<<temp<<" is armstrong"<<endl; 
    else
    cout <<"The given number "<<temp<<" is not an armstrong"<<endl; 
    return 0;
}

Embed on website

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