Advertisement
Guest User

Masha

a guest
May 20th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. """
  2. def loge(n,x):
  3.    sum=1.0
  4.    for i in range(n, 1, -1):
  5.        sum = 1 - ((float(i)-1) * x * sum / float(i)      
  6.    return (sum * x)
  7.  
  8. n=int(input("Enter the number of iteration: "))        
  9. x=float(input("The value of x is : "))
  10. print(loge(n,x))
  11. """
  12.  
  13. def loge(n, x) :
  14.     sum = 1.0
  15.     for i in range(n, 1, -1) :
  16.         sum = 1 - (float(i) - 1) * x * sum / float(i)
  17.     return (sum * x)
  18.  
  19. n = int(input("enter the number of iteration: "))
  20. x = float(input("The value of x is : "))
  21. print (loge(n, x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement