This document discusses different methods for representing algorithms, including structured English, flowcharts, and pseudo code. It focuses on pseudo code, explaining that pseudo code uses keywords and meaningful identifiers to represent the logical steps of an algorithm. The document provides examples of how to write simple algorithms using pseudo code, including input/output statements, operators, if/case statements, loops, and an example algorithm to calculate an average.
2. 2
Structured English
This is a method of showing the
logical steps in an algorithm, using
an agreed subset of straightforward
English words.
3. 3
Flowcharts
A way of making an algorithm
using a set of symbols linked
together with flow lines, the steps
required for a task and the order
in which they are to be performed.
4. 4
Pseudo code
This is a method of showing
detailed logical steps in an
algorith, using
keywords, identifiers with
meaningful names and
mathematical operators to
represent a solution.
5. 5
Writing simple algorithms using pseudo code
▲Note: Each line of pseudo code is usually a single step in an algorithm.
11. 11
Writing simple algorithms using pseudo code
To perform iteration using FOR, REPEAT–UNTIL and WHILE loops:
▲Note: A FOR loop has a fixed number of repeats, the STEP increment is an optional
expression that must be a whole number.
12. 12
Writing simple algorithms using pseudo code
Repeat statement:
▲Note: Statements in a REPEAT loop are always executed at least once.
13. 13
Writing simple algorithms using pseudo code
While loop:
▲Note: Statements in a WHILE loop may sometimes not be executed.
14. 14
Writing simple algorithms using pseudo code
Example: An algorithm to find the average of a number of integers input