Calculate exp(x)

Implement a function exp(x) that would compute and return the result of with the following formula:
The input contains a single integer x.
The function exp should compute and return the expression up until n = 10 (inclusive).
The program should print the result of exp(x), exp(2x), exp(x/2) (call the function 3 times).
Input
Output
1
2.7182818011463845 7.388994708994708 1.6487212706873655

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