In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 2nd
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #04 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

[IP030] Factorial Frenzy

The factorial of a number n is the product of all positive integers less than or equal to n. Can you help calculate the factorial of a number?

The Problem

Write a function factorial(n) that, given an integer n, returns its factorial.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

0 ≤ n ≤ 50       The integer whose factorial you need to compute

Example Function Calls Example Output
print(factorial(0))
print(factorial(5))
print(factorial(12))
1
120
479001600

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto