2.7 The "divide and average" method, an old-time method for approximating the square root of any positive number a can be formulated as x = x + a/x 2 (a) Write well-structured pseudocode to implement this algorithm as depicted in Fig. P2.7. Use proper indentation so that the structure is clear. (b) Develop, debug, and document a program to implement this equation in either a high-level language or a macro language of your choice. Structure your code according to Fig. P2.7. F SquareRoot = 0 T a > 0 tol = 10-6 x = a/2 y = (x + a/x)/2 | = |(y = x)/y|| e x = y F e < tol T SquareRoot = x

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.3: Interactive While Loops
Problem 6E: (Conversion) a. Write a C++ program to convert meters to feet. The program should request the...
icon
Related questions
Question
2.7 The "divide and average" method, an old-time method for
approximating the square root of any positive number a can be
formulated as
x =
x + a/x
2
(a) Write well-structured pseudocode to implement this algorithm
as depicted in Fig. P2.7. Use proper indentation so that the
structure is clear.
(b) Develop, debug, and document a program to implement this
equation in either a high-level language or a macro language of
your choice. Structure your code according to Fig. P2.7.
F
SquareRoot = 0
T
a > 0
tol = 10-6
x = a/2
y = (x + a/x)/2
| = |(y = x)/y||
e
x = y
F
e < tol
T
SquareRoot = x
Transcribed Image Text:2.7 The "divide and average" method, an old-time method for approximating the square root of any positive number a can be formulated as x = x + a/x 2 (a) Write well-structured pseudocode to implement this algorithm as depicted in Fig. P2.7. Use proper indentation so that the structure is clear. (b) Develop, debug, and document a program to implement this equation in either a high-level language or a macro language of your choice. Structure your code according to Fig. P2.7. F SquareRoot = 0 T a > 0 tol = 10-6 x = a/2 y = (x + a/x)/2 | = |(y = x)/y|| e x = y F e < tol T SquareRoot = x
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr