Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C please The square root of a number x can be approximated by the repeated application of the following formula: y(i) = ((-1)+ x/y(1-1)

In C please

image text in transcribed

The square root of a number x can be approximated by the repeated application of the following formula: y(i) = ((-1)+ x/y(1-1) where y() is the new estimate of the square root of x at iteration i, and y(i-1) is the estimate on the previous round. Prompt the user to enter a positive number. Check whether the number is positive. If not, re-prompt the user to enter a positive number. Calculate the square root of the user's input using a C function that yields an accuracy of 5 decimal digits. That is, the new and the old estimate differ by less than 10^-5. Use the following function prototype double root (double x); Sample Output Enter a positive number: -5 The number has to be positive. Enter a positive number: 7 The square root of 7 is 2.64575 201608.1774244 LAB ACTIVITY 16.25.1: Lab 4: P3(W): Square Root Approximation 0/4 main.c Load default template... 1 #include 2 #include 3 4 double root (double x); 5 6 int main() { 7 8 /* Type your code here. */ 9 10 return ; 11} 12 13 double root(double x){ 14 15 // write your function here 16 17 }

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions