You may also like

Can you set the logic gates so that this machine can decide how many bulbs have been switched on?

Circular Circuitry

What will happen when you switch on these circular circuits?

Not Another NAND!

Prove that you can make any type of logic gate using just NAND gates.

Procedure Solver

Stage: 5 Challenge Level:

Can you prove that the algorithm will always work?

NOTES AND BACKGROUND

When computers do their various jobs they follow very clearly described procedures. These are series of instructions where the next step at each stage is 100% clearly described: no choices or decisions need to be made; the computer is told exactly what to do. The art of the computer programmer is to work out how to break down a task into such a series of steps so that the computer knows exactly how to perform that task.

The procedure in this question is an example of such a breakdown. The computer user would input the two numbers X and Y and the computer would then run through the procedure until it terminates.

Thinking in this procedural way is an important skill to develop for anyone wishing to learn how to program a computer (and perhaps to earn a great deal of money!).

Of course, computers need to be programmed in very precise languages which are far more precise than spoken and written English. Two examples of these languages are Visual Basic for Applications, with which you can program Microsoft Excel (press Alt-f11 to bring up the VBA editor in Excel and click on help for more information) and LOGO, which you can practise using our NRICH problems (you can use our web browser version of LOGO ; please see also our series of interactive articles on how to use the LOGO programming language )