#include<stdio.h>
int factorial (int);
void main()
{
int a,fact;
printf("\nEnter a value:");
scanf("%d", &a);
fact= factorial(a);
printf("Factorial value=%d", fact);
}
int factorial (int x)
{
int f=1,i;
for(i=x;i>=1;i--)
f=f*i;
return(f);
}
Enter any number: 3
Factorial value = 6
But i did not undartand this program. Mostly in the loop condition checking in the function part. Can any one describe me the program step by step. Advanced Thanks.