When designing an algorithm or solution for a program there are two main areas to look at:
the big picture - What is the final goal?
the individual stages – What hurdles need to be overcome on the way to the goal?
Before an algorithm can be designed, it is important to check that the problem is completely understood. There are a number of basic things to know in order to really understand the problem:
What are the inputs into the problem?
What will be the outputs of the problem?
In what order do instructions need to be carried out?
What decisions need to be made in the problem?
Are any areas of the problem repeated?
Once these basic things are understood, it is time to design the algorithm.
When you write lines of code, there are three ways you can control the order these lines will be executed by the computer:
Sequencing: This means that the computer will run your code in order, one line at a time from the top to the bottom of your program. It will start at line 1, then execute line 2 then line 3 and so on till it reaches the last line of your program.
Selection: Sometimes you only want some lines of code to be run only if a condition is met, otherwise you want the computer to ignore these lines and jump over them. This is achieved using IF statements. e.g. If a condition is met then lines 4, 5, 6 are executed otherwise the computer jumps to line 7 without even looking at line 4,5 and 6.
Iteration: Sometimes you want the computer to execute the same lines of code several times. This is done using a loop. There are three types of loops: For loops, while loops and repeat until loops. That’s handy as it enables you not to have to copy the same lines of code many times.
SOURCE: http://www.101computing.net/sequencing-selection-iteration/