1.7 Problem Solving Practice


Let’s try to solve this simple problem. Let’s say you want the computer to add two numbers which you enter through an input device, and you want the computer to display the answer on the monitor. How would you write the instructions?

When figuring out an algorithm, you must remember that the computer does not have a brain, and therefore must receive explicit instructions. So, in order to perform the task stated in the above example, you will need to give instruction as follows.

First, you will ask the computer to get both numbers from the input device, add them up and then display the answer on the answer on the monitor.

But is it practical to write the instructions in long paragraph as written above? If you have a complex problem to solve, you may have a very long paragraph of instructions. This makes it very difficult to read. It would be better to write the instructions as a list. So the above paragraph can be written in a form of a list as follows :

    Get the numbers to be added from the input device
    Add both numbers
    Display the answer on the monitor