CodeMIRAI
0 XP

Factorial

Easy +30 XP Solved

Read a whole number n (0 to 12) and print n!, the product 1 × 2 × ... × n. By definition, 0! is 1.

Input
5
Expected output
120
Input
0
Expected output
1
Show a hint

Start the result at 1 so that 0! and 1! both come out as 1.

Show a solution
C
Loading the editor…
Run the tests to check your solution.