Factorial (Recursion)

MediumGrade 12

Complete the recursive Factorial(n) function. n! = n × (n-1) × ... × 1, and by definition 0! = 1. This is enrichment beyond the core CAPS content, but recursion does appear in harder papers.

Input / Output

Input: a non-negative integer n. Output: n! (n factorial).

Examples

Input

5

Expected Output

120

Input

0

Expected Output

1

+ 2 hidden tests checked on Submit.

Files

Main.pas is the entry point. Add extra units for OOP exercises — they compile together.

Main.pas
Loading...

Run your code to see test results here.