Factorials

Implement a function factorial(n) that would return the factorial of the number n:
The input contains a single integer n.
The output should contain 4 numbers - n!, (2n)!, (n-1)!, (n+1)! each on a separate line.
Input
Output
5
120 3628800 24 720
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue