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

  Determine how to set up the server for the future expansion.

Habibi's has a small network of 20 client workstations and a Windows Server 2008. Seven of those workstations are inside the restaurant and are used by the table servers to place customer orders.

  The village of marengo conducted a census

But instead of writing your pseudocode/program for "fewer than 300" households, write your pseudocode/program for EXACTLY 7 households.

  Describing dichotomy is not linearly separable

Let the d component of x be either 0 or 1. Assume we assign x to w1 if number of non-zero components of x is odd, and to w2 otherwise. Illustrate that this dichotomy is not linearly separable if d>1.

  Why is the pcm sampling time

Radio Antennas work best when the diameter of the antenna is equal to the wave length of the radio wave. Reasonable antennas range from 1 cm to 5 meters in diameter. What frequency range does this cover?

  Calculate and output the following statistics

A player wins by collecting all the cards. If a player runs out of cards while dealing the face-down cards of a war, he may play the last card in his deck as his face-up card and still have a chance to stay in the game. Once a single player holds ..

  Emerging technologies developments

Are you a optimistic or apprehensive about developments in emerging technologies that simulate human experience? Provide examples of a business condition that would benefit from each of the following?

  Explaining health insurance portability-accountability act

Based on your knowledge of IT security management, argue for or against assertions that Epworth system is in compliance with Health Insurance Portability and Accountability Act (HIPAA).

  Write a program perform using mars - assembly language

Write a program which will perform the following " using MARS - Assembly language" a. Read in a string from the user b

  Describe ease of finding information on internet

Explain main elements of assignment in the substantive way. Describe the ease of finding information on the Internet.

  Discuss at last three advantages of a hard-wired lan

Discuss at last three advantages of a hard-wired LAN compared to a wireless LAN (WLAN) and visa-versa

  Use one supper class and two sub classes

Give a UML example illustrating aggregation. Include classes, fields, methods, instance fields, etc.Use one supper class and two sub classes.inlcude pseudo code for at least one method of each class l. Also explain the whole part relationship and ..

  Develop a make-change program

The program should be written in MIPS. Develop a Make-Change program

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