Divide by the number of elements

At this point, the function in Listing 5 divides the sum by the number of elements and returns the resulting value as type double.

For the specific set of user input values shown in Figure 1, the average value was -0.4.

Obviously, the average would be different for a different set of user input values.