How does a computer work?


3d render of a robot with a symbol


A computer program is a set of instructions that tells a computer what to do in the language it understands. Computers are very good at following instructions but they may also follow wrong instructions. Computers can do various calculations and other tasks but they are dumb and need humans to give them instructions. So you need to be very clear when you give instructions to the computer. The best programs are often those which use the quickest possible way to complete a task.

Control structure:

A computer program is generally composed of three types of structures generally called control structures. Most of the computers follow the three control structures:

A) Sequence:

Instructions usually have to be completed in the right order. Computers can’t normally work out this order for themselves, so you need to program them so that they know what to do.

Lottery balls in a row isolated over white

Now if we have to find the largest number in the list of numbers above. We may just take a glance and see that 76 is the largest number. But the computer doesn’t solve the problem like that. It solves it in a sequence. First, it compares 58 with 1. Since 58 is a larger number it will store it as the largest number and check it with other numbers in the list in a proper sequence till it gets the largest number. Over here 76 is the largest number.

B) Repetition:

Computers can repeat the same task over and over again without getting bored like we do. They are very good at this and always do it perfectly. It would take a very long time to program computers if we couldn’t tell them to repeat things


A lift is a good example of repetition. A lift will always repeat the instruction when the button is pressed.

C) Selection:

Computers need to be programmed to tell them how to make decisions. They have to know what to do in many different situations. They have to make a choice or a ‘selection’.


A good example of selection is a mobile alarm. You can set an alarm at 7:30 AM every day and the mobile will ring without fail. You can even set the mobile alarm to ring on weekdays. You can skip it on weekends.

An example:


A washing machine is a good example of sequence, repetition, and selection. When you put clothes in the washing machine it washes clothes in a sequence. Water enters the washing machine. The machine washes the clothes. The next step is rinsing of the clothes. The final step is the final spin of the clothes. You can repeat the wash or final spin more than once. This is repetition. You can select different modes like economy wash, fast wash or normal wash. The washing machine will do a different wash depending on the mode you will select. This is the selection.


This is how most of the computers do their work. So most of the computers are programmed to follow any one of the control structures or more.