#include<iostream>
using namespace std;
int main()
{
int num,temp,remd;
cout<<"Enter a number:";
cin>>num;
temp=num;//storing the input variable in another variable
int sum=0;
while(num!=0)
{
remd=num%10;
sum=sum+(remd*remd*remd);
num=num/10;
}
if(sum==temp)
cout<<"Armstrong!!!!!";
else
cout<<"Not an Armstrong!!!!";
return 0;
}
using namespace std;
int main()
{
int num,temp,remd;
cout<<"Enter a number:";
cin>>num;
temp=num;//storing the input variable in another variable
int sum=0;
while(num!=0)
{
remd=num%10;
sum=sum+(remd*remd*remd);
num=num/10;
}
if(sum==temp)
cout<<"Armstrong!!!!!";
else
cout<<"Not an Armstrong!!!!";
return 0;
}
0 comments:
Post a Comment