The square roots exercise contains an algorithm in the form of a flowchart. Rather than describe the flowchart, the algorithm in text is as follows:

- Start.
- Compute (
*a*+1)/2, and assign this to*x*_{0}. - Compute (
*x*_{0}+ (*a*/*x*_{0}))/2, and assign this to*x*_{1}. - Compute the absolute value of
*x*_{1}–*x*_{0}, and assign this to*d*; compute 10^{-10}times*x*_{0}, and assign this to*e*. - If
*d*is less than or equal to*e*, then continue with step 7; otherwise, continue with step 6. - Assign
*x*_{1}to*x*_{0}. Continue with step 3. - Return
*x*_{1}as the value of the function. - End.

Click here to return to the square roots exercise page.

[ Previous page | Top of page | Next page ]

Copyright © 2001 Brian Hetrick

Page last updated 30 December 2001.

Tutorial

Building Blocks I

Control Flow II

Basic I/O

Algorithms

A First Program

Exercises

Answers

Modularization

Data Structures I

Recursion

Program Attributes

Building Blocks II

Algorithm Analysis

Structuring

Data Structures II

Abstract Types

Objects

Problem Analysis

Reference Card