Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please write me a code and make sure its variable and argument are easy to read becaue im new to this program. we just

C++
please write me a code and make sure its variable and argument are easy to read becaue im new to this program. we just started the program. also we are only jn chapter 3 so please use variabels that i could understand
image text in transcribed
A sample run
image text in transcribed
5. Given a positive real number n, and an approximation for its square root, approx, a closer approximation to the actual square root, new-approx, can be obtained using the formula: new-approx=2approxn+approx 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: f abs (x) Note: To use this function, you need to add \#include cmath after the other include statement at the beginning of your code. Enter n: 5 Enter first approximation: 2 The square root of 5=2.23607

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions