Example 49: Calculate a Factorial
Learn how to calculate the factorial of a number using recursion.
We'll cover the following...
We'll cover the following...
Problem
Write a function that uses recursion to calculate the factorial of a number passed as a parameter.
Example
| Input | Output |
|---|---|
| 5 | 120 |
| 10 | 3628800 |
Try it yourself
Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.