Three main stages are involved in creating an algorithm: data input, data processing, and results output. The order is specific and cannot be changed.
Consider a computer program that finds the average value of three numbers. First, the program must prompt the user to enter the numbers (data input). Next, the program calculates the average value of the numbers (data processing). Finally, the program displays the result on the computer’s screen (results output).
Let’s take a look at these stages in more detail.

Input 

Processing 

Output 
In some rare situations, the input stage may be absent and the computer program may be composed of only two stages. For example, consider a computer program that is written to calculate the following sum.
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
In this example, the user enters no values at all because the computer knows exactly what to do. It must calculate the sum of the numbers 1 to 10.
Now let’s take a look at the same example, slightly altered. Consider a computer program that is written to calculate the following sum.
1 + 2 + 3 + … + N
Of course, this sum is not the same as the previous one. In this example, the user needs to input some data. The computer cannot decide by itself about the exact value of number N. This value must be entered by the user. Once the user enters a value for N, the computer can proceed to calculate the result. For example, if the user enters the number 5, the computer can then find the result of 1 + 2 + 3 + 4 + 5.