C
Chris Angelico
Just to be pedantic, by any reasonable definition, 0! == one, not zero.
One reference: http://en.wikipedia.org/wiki/Factorial
3rd sentence.
Hm! I never thought to check the definition... I just coded it up
quickly, and didn't even consider the possibility of a zero return
until the cache's loophole was challenged. Guess with a more correct
definition of factorial, it's even safer in the cache.
Question: How many factorial functions are implemented because a
program needs to know what n! is, and how many are implemented to
demonstrate recursion (or to demonstrate the difference between
iteration and recursion)?
ChrisA