Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (anonymous):

Design an algorithm to find the square root of a positive number by starting with the number itself as the first guess and repeatedly producing a new guess from the previous one by averaging the previous guess with the result of dividing the original number by the previous guess. Analyse the control of this repetitive process. In particular, what condition should terminate the repetition?

OpenStudy (anonymous):

I think this is the first video of those SICP lectures or somewhere in the SICP book :) nice

OpenStudy (anonymous):

I made a quick console application in C# that does what You asked. Hope it helps: double v = Convert.ToDouble(Console.ReadLine()); // the original number double sqr = Math.Sqrt(v); // the square root of the number double prevGuess = v; //the previous guess while (prevGuess != sqr) // this loop iterates until the square root of the number is found prevGuess = (prevGuess + (v / prevGuess)) / 2; Console.Write(prevGuess); //write the result

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!