#C3946. Recursive Factorial Computation

    ID: 47429 Type: Default 1000ms 256MiB

Recursive Factorial Computation

Recursive Factorial Computation

Given a non-negative integer n, compute its factorial using a recursive algorithm. The factorial of a number n (denoted as \(n!\)) is defined as:

\[ n! = \begin{cases} 1, & n=0 \\ n \times (n-1)!, & n > 0 \end{cases} \]

Your task is to write a program that reads an integer from standard input (stdin), computes \(n!\) using recursion, and prints the result to standard output (stdout).

inputFormat

The input consists of a single line containing a non-negative integer n.

Example:

5

outputFormat

Output the factorial of the given number \(n!\) as a single integer.

Example:

120
## sample
0
1