➽ Program:-
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int num, sum = 0,
rem, cube = 0, temp;
cout<<"Enter a Number: ";
cin>> num;
temp = num;
while(num != 0)
{
rem = num % 10;
cube = pow(rem, 3);
sum = sum + cube;
num = num / 10;
}
if(sum == temp)
cout<< temp << " is an Armstrong No";
else
cout<< temp << " is not an Armstrong No";
}
➽ Output:-
Enter a Number: 371
371 is an Armstrong No
Enter a Number: 1600
1600 is not an Armstrong No
0 Comments
Please do not enter any spam link in the comment section.