وإياك ,, ولكن في حلك السابق انت استخدمت مفهوم الـ Recursive وليس مفهوم الـ Iterative .
الحل الصحيح باستخدام اللوب (Iterative) :
كود PHP:
int main (void)
{
int n,fact=1,i;
printf("Enter number for to computes the factorial >");
scanf("%d", &n);
if (n != 0)
{
for (i=n; i > 1; i--)
{
fact = fact * i;
}
printf(" factorial = %d\n",fact);
}
return(0);
}
بالتوفيق .