Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- x = float(input())
- n = int(input())
- cur = 1.
- e = math.exp(x)
- print("%.10f"%abs(e - cur))
- for i in range(n - 1):
- cur += (x ** (i + 1)) / math.factorial(i + 1)
- print("%.10f"%abs(e - cur))
Advertisement
Add Comment
Please, Sign In to add comment