hi i am trying to program a code from these instruction : First, design and impl
ID: 675339 • Letter: H
Question
hi
i am trying to program a code from these instruction :
First, design and implement a Python program that takes a positive whole number n as input and outputs the square root of n using the Babylonian algorithm. The Babylonian algorithm computes the square root of a positive number, n, as follows: 1. Make a guess at the answer (you can pick n/2 as your initial guess). 2. Compute r = n / guess 3. Set guess = (guess + r) / 2 4. Go back to step 2 for as many iterations as necessary. The more steps 2 and 3 are repeated, the closer guess will become to the square root of n. 5. Compare your calculated square root with the math.sqrt() result.
Explanation / Answer
import java.util.Scanner;
02 public class Babylonian {Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.