Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that uses Newton's method to compute a squareroot. Objectives: Do-while looping Error cheek the user with a while loop if negative number

image text in transcribed

Write a program that uses Newton's method to compute a squareroot. Objectives: Do-while looping Error cheek the user with a while loop if negative number entered Successful implementation of an algorithm Learn the fabs function Define a tolerance Sample Output: Enter a positive number: 3 Enter a guess: 1 squareroot: 1.73205 Newton's Method: Let x be the number entered by the user. Newton's method requires an initial guess y for the squareroot of x. In the example below, the guess is 1. Successive guesses are found by computing the average of y and x/y. The following table shows how the squareroot of 3 would be found: Note that the values of y get progressively closer to the true squareroot of x. For greater accuracy, your program should use variables of type double rather than float. Have the program terminate when the absolute value of the difference between the old value of y and the new value of y is less than .00001

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Write or share answers to the following questions:

Answered: 1 week ago