Skip to content

Pseudocode

As problems get more difficult or complex it is necessary to sketch out potential solutions. There are various tools available for programmers to do this such as flowcharts, which we met in the previous chapter, or pseudocode.

Pseudocode is simply a way of writing out an algorithm which is independent of any programming language. It should be written in such a way that a non-programmer could read it and know what the steps are in the algorithm. There is no standard, or correct way, of writing pseudocode. It will look like code, without being code. For example:

1
2
3
4
5
6
7
Set total to zero
Set grade counter to one
While grade counter is less than or equal to ten
    Input next grade
    Add grade to the total
Set the class average to the total divided by ten
Print class average