← Problem book: C
Lesson 90 of 96 · 10 XP
Factorial with recursion
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
Write a recursive function fact(n): fact(0) = 1, and fact(n) = n · fact(n - 1). Read n (0 ≤ n ≤ 12) and print n!.
Example
Input:
5
Output:
120
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.