Write a program that inputs an integer for n

Assignment Help Basic Computer Science
Reference no: EM13308003

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 an integer for n, iterates through the Babylonian algorithm twenty times, and outputs the answer as a double to two decimal places. Your answer will be most accurate for small values of n.

Reference no: EM13308003

Questions Cloud

How high does the pendulum swing : A ballistic pendelum of mass 1kg is struck by a 0.003kg bullet moving at 600 m/s. How high does the pendulum swing
initialize the temperature to 100 degrees celsius : Initialize the temperature to 100 degrees Celsius. In a loop, decrement the Celsius value and compute the corresponding temperature in Fahrenheit until the two values are the same.
Determine the principal stresses and the principal angle : using the stress transformation quations only,given a stress state where sigma x=6500 psi,sigma y= 17,300 psi and tau xy=2900 psi, determine the principal stresses,the principal angle and the maximum shear stress.
Ongoing data exploration : Ongoing Data Exploration
Write a program that inputs an integer for n : Write a program that inputs an integer for n, iterates through the Babylonian algorithm twenty times, and outputs the answer as a double to two decimal places. Your answer will be most accurate for small values of n.
How far does the mass move up along the plane : A mass of 10kg is sliding up a frictionless plane inclined at 10 degree. How far does the mass move up along the plane
What length does the observer measure : A spaceship is measured to be 158 m long while at rest relative to the observer. what length does the observer measure
Find the difference in volume between the cubes : You construct two wire-frame cubes, one using (infinitely thin) copper wire, the other using (infinitely thin) aluminium wire. Find the difference in volume between the cubes
Determine stresses acting on an element oriented at angle : Using the stress transformation equations only,given a stress state where sigma x=105 MPa,sigma y=75 MPa and tau xy=25 MPa, determine the stresses acting on an element oriented at an angle 40 degrees from the x axis.

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  How many bits are used for memory addresses

How many bits are used for memory addresses

  Verify local police department-s findings on current case

Your computer investigation firm has been hired to verify local police department's findings on current case. Tension over the case is running high in the city.

  Write a java method to five a 10 percent raise to every

write a java method to five a 10 percent raise to every employee who has a student record and whose grade point index is higher than 3.0.

  Use a single if statement and boolean operators

Write a program that asks the user for a year and computes whether that year is a leap year. Use a single if statement and Boolean operators.

  Wish to represent an n-vertex graph

Suppose we wish to represent an n-vertex graph G using the edge list structure, assuming we identify the vertices with the integers in the set {0,1,...,n?1}.

  Who are getting advantages from piracy robberies

Why are (were) pirates difficult to eliminate? What to you believe about pirates as moder-day Robin Hoods? Who are getting advantages from piracy robberies?

  Difference between cyber crimes and cyber-related crimes.

Summarize the difference between cyber crimes and cyber-related crimes. On cyber crimes, define cyber trespass, cyber privacy and cyber vandalism. On cyber-related crimes explain the difference between cyber-assisted and cyber-enhanced crimes.

  Draw a possible class diagram,uml diagram for the system

Ship A has two instruments, which provide digital information for navigation: (1) A global positioning system (GPS) measures the position and velocity of Ship A.

  Draw the logic diagram for a circuit that resolves priority

Q:  "Draw the Logic diagram for a circuit that resolves priority among eight active-low inputs, 10_L-17_L, where 10_L has the highest priority.

  Write a program to support children spelling game hangman

The traditional way to play hangman is to draw a figure on a gallows. Another part of the hanged man is added for each incorrect guess.

  Explaining multiple-level total

Whch of the following is an example of a multiple-level total? A total shown at the end of report for number of books in a library or Total shown every time the type of book changes (for example, reference, fiction, nonfiction).

  Explain purpose or benefits of it steering committee

Explain the purpose of an IT steering committee, and identify the benefits of the committee.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd