Factorial
Calculates the factorial of a number.
- Use recursion.
- If
numis less than or equal to1, return1. - Otherwise, return the product of
numand the factorial ofnum - 1. - Throws an exception if
numis a negative or a floating point number.
Calculates the factorial of a number.
num is less than or equal to 1, return 1.num and the factorial of num - 1.num is a negative or a floating point number.