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.

  1. Prompt the user to enter a number.
  2. Prompt the user to enter a second number.
  3. Prompt the user to enter a third number.


  1. Calculate the sum of the three numbers.
  2. Divide the sum by 3.
  1. Display the result on the screen.

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.

One Response to The Three Main Stages Involved in Creating an Algorithm

  • Knowing algorithms is always helpful to our programming career. I made fraction calculator apps using java for android phones and I developed also fraction calculator using php for Trust me, it is really hard to make an application without the algorithm first. This is one of the algorithm that kept circling my head when I was doing the application.

    Check if denominator are equal.

    If yes, just add the numerator.

    If not, list all multiples for each denominator

    Get the least common multiple.

    Use the least common multiple to make all fraction the same denominator.

    Then add the numerator.

    Doing algorithms will always be a part of our lives as a programmer.

Leave a Reply

Your email address will not be published. Required fields are marked *

This article is taken from a book of mine. If you enjoyed it, please visit my author's page inand check out all of my books!