One way to compute the square root of a real number x is to use the Babylonian algorithm. You begin by guessing that the square root of x is x / 2. The steps of this algorithm are as follows: guess =...


One way to compute the square root of a real number x is to use the Babylonian algorithm. You begin by guessing that the square root of x is x / 2. The steps of this algorithm are as follows:


guess = x / 2


previousGuess = 0


Repeat until guess is within 1% of previousGuess


{


r = x / guess


previousGuess = guess


guess = (guess + r) / 2


}


Write a program that reads a number and computes its square root by using the Babylonian algorithm. Display your results to two decimal places. You should get an accurate answer even for large numbers.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here