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 program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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