Question 1 of 4

Factorial

Loops

Using a loop, compute and print the factorial of the given `n`.

Example 1:

Input: n = 5

Output: 120

Explanation: 5! = 5 × 4 × 3 × 2 × 1 = 120.

Example 2:

Input: n = 1

Output: 1

Example 3:

Input: n = 0

Output: 1

Code

Testcase / Output

Default testcase

n = 5

Expected output

120

Returned results

Click Run to execute your code against the testcase.