Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Modify the program so that the it should compare the ratio of x and Guess to 1. #include 5 float absolutevalue (float x) if

The Modify the program so that the it should compare the ratio of x and Guess to 1.

image text in transcribed

#include 5 float absolutevalue (float x) if (x 0) return (x); 2 float squareroot (float x) const float epsilon = 0.00001; float guess = 1.0; while (absolutevalue ( guess * guess -x)>= epsilon) guess = (x/ guess + guess)/ 2.0; return guess; 2 int main (void) printf("squareroot printf("squareroot printf("squareroot (2.0) %f ", squareroot (2.0)); (144.0) = %f ", squareroot (144.0)); (17.5) -%f ", squareroot (17.5)); return 0 #include 5 float absolutevalue (float x) if (x 0) return (x); 2 float squareroot (float x) const float epsilon = 0.00001; float guess = 1.0; while (absolutevalue ( guess * guess -x)>= epsilon) guess = (x/ guess + guess)/ 2.0; return guess; 2 int main (void) printf("squareroot printf("squareroot printf("squareroot (2.0) %f ", squareroot (2.0)); (144.0) = %f ", squareroot (144.0)); (17.5) -%f ", squareroot (17.5)); return 0

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 Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

What is the difference between n-type and semiconductors?

Answered: 1 week ago