Question: Write a function called SquareRoot that takes a double as a parameter and that returns an approximation of the square root of the parameter, using


Write a function called SquareRoot that takes a double as a parameter and that returns an approximation of the square root of the parameter, using this algorithm. You may not use the sqrt() function from the math.h library.
Exercise 6.3 Let's say you are given a number, a, and you want to find its square root. One way to do that is to start with a very rough guess about the answer, xo, and then improve the guess using the following formula: 6, then For example, if we want to find the square root of 9, and we start with x0 X1 (6 + 9/6)/2-15/4 3.75, which is closer. We can repea the procedure, using Ti to calculate x2, and so on. In this case, T2 3.075 and x3 3.00091. So that is converging very quickly on the right answer (which is 3) Write a function called SquareRoot that takes a double as a parameter and that returns an approximation of the square root of the parameter, using this algorithm You may not use the sqrt() function from the math.h library
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
