Now you'll compute , the product of all positive integers up to . For example, .
Factorial is perfect for recursion because it has natural structure: Every factorial depends on a smaller factorial.
You could use a loop, but recursion matches the mathematical definition exactly. plaintext Input: 5 Output: 120 Input: 0 Output: 1 Before reading on, think about this: what's the base case? And what's the recursive relationship?