Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please C++ programming 27 5. Given a positive real number n, and an approximation for its square root, approx, a doser approximation to the actual

please C++ programming image text in transcribed
27 5. Given a positive real number n, and an approximation for its square root, approx, a doser approximation to the actual square root, new-approx, can be obtained using the formula: + approx approx new-approx= 2 I Using this information, write a program that prompts the user for a positive number and an initial approximation to the square root of the number, and then approximates the actual square root of the number accurate to 0.00001. Hint: Using the initial approximation as the first value of approx, repeatedly calculate a new-approx, using the above formula, until the absolute value of the difference between the new-approx and approx is less than or equal to 0.00001. If the difference is greater than 0.00001, then calculate another new-approx, using its previous value as the value of approx. Note: The function fabs should be used to calculate the needed absolute value. To find the absolute value of a variable x, include this code: fabs(x) Note: To use this function, you need to add #include after the other include statement at the beginning of your code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions