All tasks
Easymathrecursion

Factorial

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

You are given an integer n. Print n! = 1 · 2 · … · n. By definition 0! = 1.

Examples

Example 1
Input
5
Output
120
Example 2
Input
0
Output
1

Constraints

  • 0 ≤ n ≤ 20
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.