Now we have the data in the program, we can start to think about the statistics we want to calculate.
The sum is the simplest of the statistics. This involves adding together all the numbers in the array. The main issue here is that the computer cannot add all of these values together, and we must rethink our logic to express it in terms of processing for each element.
Think about the way you would sum a list of numbers, this is now the task you need to code for the computer. What is it that you do with each number? To think this through write a list of random numbers down. Keep it simple, make each number between 0 and 9. Now calculate the sum. Do it slowly, and think about the tasks that you are performing for each number. Allow yourself only to look at one number at a time.
You should have noticed that you achieve this by keeping a running total, and that you add the value of each number from the list to that total. When you have done this for each number in the list, you have the sum of all values. The pseudocode for this is shown below.
Have a go at coding this yourself.
Make sure to test your program is working. You should be able to enter different numbers of values each time, and see the sum of the values you entered.