Code Snippets C

#include
long factorial(long);
void main()
{
long number = 0;
printf("\nEnter an integer value: ");
scanf(" %ld", &number);
printf("\nThe factorial of %ld is %ld\n", number, factorial(number));
}
/* recursive factorial function */
long factorial(long i)
{
if( i < 2 )
return i;
else
return i*factorial(i - 1);
}