Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c + + The Babylonian algorithm to compute the square root of a number n is as follows: 1 . Make a guess at

using c++
The Babylonian algorithm to compute the square root of a number n is as
follows:
1. Make a guess at the answer (you can pick n/2 as your initial guess).
2. Compute r = n / guess
3. Set guess =(guess + r)/2
4. Go back to step 2 for as many iterations as necessary. The more that
steps 2 and 3 are repeated, the closer guess will become to the square
root of n.
Write a program that inputs a double for n and iterates through the
Babylonian algorithm 100 times. For a more challenging version, iterate
until guess is within 1% of the previous guess, and outputs the answer as
a double.

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago