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.
Main.pas is the entry point. Add extra units for OOP exercises — they compile together.
Run your code to see test results here.