Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The C++ code below uses float type variables x, y, z, and square. It computes the square root of the variable square by repeatedly moving

The C++ code below uses float type variables x, y, z, and square. It computes the square root of the variable square by repeatedly moving x and y closer together so that x*x <= square and y*y >= square until they are so close that either one could be used as the square root. Complete the code below by making the compound statement {...} into a do/while loop that continues until the difference y-x is smaller than 0.001. You may use the literal constant 0.001 in your answer. x = 0.0; y = 100.0; { z = (x + y) / 2.0; if (z*z > square) y = z; else x = z; } 

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

What is the typical process of friendship development?

Answered: 1 week ago