Recursive factorial


SUBMITTED BY: Guest

DATE: Jan. 16, 2014, 6:50 p.m.

FORMAT: C#

SIZE: 198 Bytes

HITS: 867

  1. static int RecursiveFactorial(int value)
  2. {
  3. if (value < 0)
  4. throw new Exception("Bad boy!");
  5. if (value == 0)
  6. return 1;
  7. return value * RecursiveFactorial(value - 1);
  8. }

comments powered by Disqus