Kraken - 11 months ago 66

C Question

How can I write a program to find the factorial of any natural number?

Answer Source

This will work for the factorial (although a very small subset) of positive integers:

```
unsigned long factorial(unsigned long f)
{
if ( f == 0 )
return 1;
return(f * factorial(f - 1));
}
printf("%i", factorial(5));
```

Due to the nature of your problem (and level that you have admitted), this solution is based more in the concept of solving this rather than a function that will be used in the next "Permutation Engine".