#include<stdio.h>
main()
{
int num,i,j,temp,sum=0;;
printf("Enter a number to know whether it is armstrong or not\n");
scanf("%d",&num);
temp=num;
while(num>0)
{ int factorial=1;
i=num%10;
for(j=1;j<=i;j++)
{
factorial=factorial*j;
}
sum+=factorial;
num=num/10;
}
if(sum==temp)
{
printf("Given number %d is an Strong number\n",temp);
}
else
{
printf("Given number %d is not an Strong number since the sum of factorials of individual digits is %d\n",temp,sum);
}
}
Note: Need to be arranged in compiler after copied
OutPut 1:
Enter a number to know whether it is armstrong or not 145 Given number 145 is an Strong number
OutPut 2:
Enter a number to know whether it is armstrong or not 153 Given number 153 is not an Strong number since the sum of factorials of individual digits is 127