fact=1;
for(i=r;i>=1;i--)
{
fact = fact*i;
}
When calculate factorial then initial value of fact change so when loop move next step then fact value store previous, first define initial value of fact just before for loop so fact value not change and it is always 1. /
#include <stdio.h>
int main()
{
int n,i,r,sum =0,fact ,temp;
printf("Enter number = ");
scanf("%d",&n);
temp = n;
while(n>0)
{
r = n%10;
fact=1;
for(i=r;i>=1;i--)
{
fact = fact*i;
}
sum = sum + fact;
n= n/10;
}
n=temp;
if(n==sum)
printf("strong number");
else
printf("not a strong number");
}