Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
All that the program described in Section 5.6 currently does is store and output the data. How else might it be used? Well, we could compare the performance of different regions across the year, using the total sales of each. This is equivalent to adding all four values across each row of the table in turn. To do this, declare a variable, total, and set it to zero. Then add all figures of the four quarters for a region to total.
total = 0;
for (quarter = 0; quarter < 4; quarter++)
total = total + sales[region][quarter];