Recursive factorial

Write a function that returns @n@!.

Solve this problem recursively.

Interface

+-------:+:----------------------------------------+
| C++    |     int factorial(int n);               |
+--------+-----------------------------------------+
| C      |     int factorial(int n);               |
+--------+-----------------------------------------+
| Java   |     public static int factorial(int n); |
+--------+-----------------------------------------+
| Python |     factorial(n)  # returns int         |
+--------+-----------------------------------------+
|        |     factorial(n: int) -> int            |
+--------+-----------------------------------------+

Precondition

Assume 0≤ @n@  ≤ 12.

Observation

You only need to submit the required procedure; your main program will
be ignored.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:03:01.906Z

© Jutge.org, 2006–2026.
https://jutge.org
