Write a program that inputs an integer for n

Assignment Help Computer Engineering
Reference no: EM13322843

Square Root <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
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: EM13322843

Questions Cloud

Write a void function definition for a function : Write a void function definition for a function called add_tax. The function add_tax has two formal parameters taxrate.
Write a function declaration and function definition : Write a function declaration and function definition for a function which allows the user to input an argument of type double.
Write a program that simulates the roll of two dice : Write a program that simulates the roll of two dice using the random number generators. You will call the rand () function once for each dice. Each rand() call will return a number between 1 and 6.
What is the index of refraction of the reflecting material : The angle of incidence of a light beam in air onto a reflecting surface is continuously variable. What is the index of refraction of the reflecting material
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.
Find the intensity of the beam : The polarizers are rotated, so that the second polarizer has a transmission of 43.6 degrees with respect to the first polarizer, find the intensity of the beam
State a reaction mechanism for the chlorination of 1-butene : Write a reaction mechanism for the chlorination of 1-butene by Cl2. Use curved arrows to show electron movement. Show structures of key reaction intermediates and products and indicate the stereochemistry of the reaction.
Find the current induced in the coil : A strong electromagnet produces a uniform magnetic field of 1.60 T over a cross-sectional area of 0.260 m2. What is the current induced in the coil
The stereoselectivity and regioselectivity of the reaction : 2-iodo-4-methylpentane was refluxed for an hour in the presence of sodium isopropoxide. Name and draw the product(s) of this reaction clearly showing the stereoselectivity and regioselectivity of the reaction.

Reviews

Write a Review

Computer Engineering Questions & Answers

  How could companies offering "free" products

The seminar uses Linux as an example of a company that understands competitive positioning. How can companies offering "free" products (e.g., Linux, Netscape) make money from these products? How can other companies compete with these fast-rising s..

  Design the function "count" which takes a list of items

design the function "count" which takes a list of items and an item as arguments, and returns the number of times the item occurs in the list.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  Design visual basic 2010 program to analyze a mortgage

Write down a Visual Basic 2010 program to analyze a mortgage. The user should enter the amount of the loan, the annual rate of interest, and the duration of the loan in months.

  Determine the average number of tries

Write down a program in C++ to play a guessing game with the user. The program should be able to make a guess about the chosen number by the user and ask whether the guessed number is above or below the chosen number.

  Why would you recommend a multi-core cpu

Discussion is designed to help you know the roles of hardware and software components in a modern computer system. For the purposes of this Discussion, assume that you are heading a team of 25 people working on a software development project.

  Make an efficient object-oriented java application

while a house is chosen by the roommates, the user will give information for it. To allow extensibility, a house object can be created with no information available, address of the house only or the address of the house, monthly rent and security d..

  Program to calculate salary of family members

Suppose that your family has 10 members. Suppose further that every family member has the particular amount of the savings. Your task is to find: The total amount of savings that the family has, as a whole and To find who has the largest savings.

  What is a data type in c

What is the difference between a constant and the variable in a program? Why would you use one or the other.

  What aspects of environment support structure of colleges

What aspects of environment support structure of colleges.

  Give difference between posttest and pretest loops

What is the major difference between posttest and pretest loops.

  Benefit and drawback of each major operating system

Benefit and drawback of each major operating system

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