The Modern C# Challenge
上QQ阅读APP看书,第一时间看更新

4. Factorials

The factorial of a non-negative integer number, N, is written N! and is given by the equation N! = 1 × 2 × 3 × ... × N. You can also define factorials recursively as N! = N × (N – 1)! By definition, 0! = 1.

Write a program that calculates factorials recursively and non-recursively. Is one version better than the other? What is the limiting factor for calculating factorials?