Recursion
Recursion-03
Recursion-04
Recursion-05
~/algor $ cat problems/rekursiya-faktorial
Factorial
Easy
1000 ms
64 MB
23%
You are given a non-negative integer $n$. Using a recursive function, compute $n!$ (n factorial):
$$0! = 1$$
$$n! = n \times (n - 1)! \quad (n \ge 1)$$
Input
One line with one integer $n$ ($0 \le n \le 12$).
Output
The value of $n!$.
Note
$0 \le n \le 12$. The result fits in a standard 32-bit integer.
Examples
Input #1
0
Output #1
1
Input #2
5
Output #2
120