GerONSo

Untitled

Oct 24th, 2020 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. import math
  2. x = float(input())
  3. n = int(input())
  4. cur = 1.
  5. e = math.exp(x)
  6. print("%.10f"%abs(e - cur))
  7. for i in range(n - 1):
  8. cur += (x ** (i + 1)) / math.factorial(i + 1)
  9. print("%.10f"%abs(e - cur))
  10.  
Advertisement
Add Comment
Please, Sign In to add comment