Ng stands for next guess

Assignment Help C/C++ Programming
Reference no: EM13164926

The square root of a number N can be approximated by repeated calculation using the formula NG = 0.5( LG + N/ LG)

where NG stands for next guess and LG stands for last guess. Write a function that calculates the square root of a number using this method. The initial guess will be the starting value of LG .

The program will compute a value for NG using the formula given. The difference between NG and LG is checked to see whether these two guesses are almost identical. If they are, NG is accepted as the square root; otherwise, the next guess (NG) becomes the last guess (LG) and the process is repeated (another value is computed for NG, the difference is checked, and so on). The loop should be repeated until the difference is less than 0.005. Use an initial guess of 1.0. Write a driver function and test your square root function for the numbers 4, 120.5, 88, 36.01, 10,000, and 0.25.

Reference no: EM13164926

Questions Cloud

Write a simple java program that will read an array of info : write a simple java program that will read an array of information containing the information (Name, offence [between arson, assault or theft] and year of offence
Class automobile has a composite object : Assume that a definition of class Automobile has a composite object called my Engine. Also assuembers of class Engine me the all the data members of class Engine that contain information
Calculate number of grams of aluminum required to prepare : Calculate the number of grams of aluminum required to prepare 500.0g of chromium metal.
Two-dimensional arr named number of three rows : Given a two-dimensional arr named number of three rows and four columns of type ont, write the nigle code statement that both declare and initialize the arry such that the first row is initialize to 0,1,2,3, the second row is initialized to 4,5,6,..
Ng stands for next guess : Where NG stands for next guess and LG stands for last guess. Write a function that calculates the square root of a number using this method. The initial guess will be the starting value of LG .
Would king and queen be liable to efl : Would your answer change if EFL had written to King and Queen advising you that they intended to make a loan to Impulse and were relyingon the 2012 audited financial report to assist them in making their decision?
Gender-specific terms : I think it is problematic to use gender-specific words like the examples of "policeman" and "waitress". The reason is these words are reflecting stereotypical descriptions of roles that are appear to be male or female exclusively. This is considered ..
What is the final temperature of the block : Assume that the heat required for the vaporization of the alcohol comes only from the aluminum block and that the alcohol vaporizes at 25. Suppose that 1.15 of rubbing alcohol evaporates from a 65.0 aluminum block.
The counter each time it''s clicked : Write a simple script that contains a button and a counter in a div. The button's event handler should increment the counter each time it's clicked.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a template class

Create a template class, SVector, that implements a constructor

  Struct complex

A complex number can be represented by two parts, real and image. A series complex data can be organized as a group of elements by linked list, which is shown as below: struct Complex

  Given the following test scores and grade equivalents

Given the following test scores and grade equivalents, write a function which is passed a score, and returns a letter grade based on the score entered. A number less than 0 or greater than 100 is invalid.

  Write program to declare the array of type float

Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.

  Wrtie a function called gen_rand_double_array

Wrtie a function called gen_rand_double_array that generates 900 samples of size 22500 random numbers from U(10, 12). For each of these 900 samples, write a main funciton that calculates the mean and finds the simulated probability that the mean is b..

  Complete the payroll program with following driver object

complete the payroll program with the following driver objects.

  Function named sort that takes three integer parameter

Write a function named sort that takes three integer parameters by reference. The function should rearrange the parameter values so that the first parameter gets set to the smallest value, the second parameter gets set to the second smallest value, a..

  Searching f and removing certain states from the hash table

use the class hashT, ''Hashing: Implementation Using Quadratic Probing,'' which uses quadratic probing to resolve collision, to create a hash table to keep track of each state's information. Use the state's name as the key to determine the hash addre..

  Prepare a program for a retail-mart company

Prepare a program for a company Retail-Mart.

  Take an n x n matrix, and create a new, (n-1) x (n- 1)

take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bounds.

  Write c program to find smallest-largest values

Write a program c that will find the smallest, largest and average values in a collection of N numbers.Get the value of N before scanning each value in the collection of N numbers.

  Iterative programming problem solving approaches

Write a recursive function void reverse ( ) that reverse a sentence

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