Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that computes the square rootof an integer using Newton's method. This is a technique thatcomputes the square root of a given

Write a C program that computes the square rootof an integer using Newton's method. This is a technique thatcomputes the square root of a given number iteratively, startingwith an initial guess. Therefore, the program will need twointegers as input. The first one is the number of which you wouldcompute the square root. The second number is the initial guess.Use 5 iterations of Newton’s method to compute the square root ofthe first number and print the output.

You can use the atoi function from to convert a string to aninteger.

Sample Input

1100 50

Sample Output

Your initial guess is: 50.00Your input number to be square rooted: 1100After iteration 1, the approximate square root is: 36.00000After iteration 2, the approximate square root is: 33.27778After iteration 3, the approximate square root is: 33.16643After iteration 4, the approximate square root is: 33.16625After iteration 5, the approximate square root is: 33.16625

Explanation

We want to compute the square root of 1100, and our initialguess is 50. After each iteration, we print the approximate valueof the square root computed using Newton's method.

Code

#include
#include
#include

int main(int argc, char *argv[]) {
// Add your code here
return 0;
}

Step by Step Solution

3.40 Rating (156 Votes )

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

Java Software Solutions

Authors: John Lewis, William Loftus

9th Edition

9353063612, 978-9353063610

More Books

Students also viewed these Programming questions

Question

a sin(2x) x Let f(x)=2x+1 In(be)

Answered: 1 week ago

Question

Java is case sensitive. What does that mean?

Answered: 1 week ago