Solve Problems by Coding Solutions - A Complete solution for python programming
def squareRoot(n):
x = n
y = 1
e = 0.000001
while (x - y > e):
x = (x + y) / 2
y = n/x
return x
def findMaximumHeight(N):
n = 1 + 8*N
maxh = (-1 + squareRoot(n)) / 2
return int(maxh)
N = 12
print(findMaximumHeight(N))
Post a Comment
No comments:
Post a Comment