Before we get to writing actual code, lets solve the rest of the riddle of how to get that average.
So now we have one place to store the total. How do we actually add these numbers to the total?
Lets think about the add process. Are you not always adding to the total?
1) add 70 to the total 2) add 80 to the total 3) add 80 to the total 4) add 75 to the total 5) add 85 to the total 6) add 80 to the total 7) add 82 to the total
Hey that looks very promising. Time for more pseudo code.
int Total;
Total + 70; Total + 80; Total + 80; Total + 75; Total + 85; Total + 80; Total + 82;
There we go, that's exactly what you did when you used the calculator kept adding more numbers to the total
See how logical it all is, break it down into steps and there you go.
Well the next step to calculate a average is to divide the total by the number of tests, in this case 7, so if adding is done by the plus sign , surely divide is jsut as easy?
Total divide by 7;
Well yes and no. Looking at your keyboard u will soon see there is no symbol for divide. Huh?
No there is no traditional symbol, the symbol for divide on the computer is the "/" key, therefore we know have:-
int Total;
Total + 70; Total + 80; Total + 80; Total + 75; Total + 85; Total + 80; Total + 82;
Total / 7;
There you go. You divided the total by 7 and now know what the average is. It's 79 by the way.