#include<stdio.h>
int main()
{
int n,num,sum,digit;
printf("Enter a Number:\n");
scanf("%d",&n);
num=n;
sum=0;
while(n!=0)
{
digit=n%10;
sum=sum+digit*digit*digit;
n=n/10;
}
if(num==sum)
{ printf("The Sum no %d is an armstrong number",num);
}
else
{ printf("The Sum no %d is not an armstrong number",num);
}
return 0;
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter a Number:
153
The Sum no 153 is an armstrong number