# Calculator Programming Tutorial

## Programming Building Blocks I

### Exercises

#### Square Roots

##### Algorithm Description

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:

1. Start.
2. Compute (a+1)/2, and assign this to x0.
3. Compute (x0 + (a/x0))/2, and assign this to x1.
4. Compute the absolute value of x1x0, and assign this to d; compute 10-10 times x0, and assign this to e.
5. If d is less than or equal to e, then continue with step 7; otherwise, continue with step 6.
6. Assign x1 to x0. Continue with step 3.
7. Return x1 as the value of the function.
8. End.

Page last updated 30 December 2001.

# Brian’s Casio Calculator Corner

Home

Programs

Tutorial

Preface

Introduction

Fundamentals

Building Blocks I

Introduction

Data Types

Numbers

Variables

Expressions

Control Flow I

Control Flow II

Subprograms

Basic I/O

Algorithms

A First Program

Examples

Exercises

Square Roots

Clock Hands

Modularization

Data Structures I

Recursion

Program Attributes

Building Blocks II

Algorithm Analysis

Structuring

Data Structures II

Abstract Types

Objects

Problem Analysis

Reference Card

References

Puzzles

Site Information