Pseudocode Compiler
Practice

Factorial

MEDIUMProcedures & Functions

Read a non-negative integer N (0 ≤ N ≤ 12). Output N! (N factorial).

Recall: 0! = 1, and N! = N × (N−1) × … × 1.

Input: A non-negative integer N. Output: The value of N!.

Example:

Input:  5
Output: 120
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: 5!
Inputs: 5
Expected: 120
Test 2: 0! = 1
Inputs: 0
Expected: 1
Test 3: 1!
Inputs: 1
Expected: 1
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade