A method known as the Newton-Raphson method allows us to calculate the square ro
ID: 3620624 • Letter: A
Question
A method known as the Newton-Raphson method allows us to calculate the square root of apositive real number a as follows: start with x = 1.0. Then set y = ( x + a / x ) / 2. If x and y are not yet close enough, then set x = y and recalculate y. Stop when the difference between x and y is small enough to be negligible. Write a C program to calculate the square root of a given number this way. Your program should read both a and the desired tolerance (i.e. the desired difference between x and y), e.g. 0.0001.
Sample Output 2:
Enter a positive real number: 9
Enter the tolerance: 0.0002
Square root of 9.000000 is 3.000000
Explanation / Answer
please rate - thanksRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.