I'm working on a program that finds the average of four numbers, so that they can be stored on an array. The program is complete, but with one fatal flaw: I think the do-while loop is written in a way that keeps giving me a garbage output. I've tried various ways of writing the do-while code, but I still can't get it quite right. This is what it looks like so far, if you could just give me a clue as to what I'm doing wrong.
To access arrays you start from 0, not 1
'grade' has 4 elements, and they will be stored at indexes (indices?) 0, 1, 2, 3
On line 34 you access grade[4] four times (because the loop stops when i == 4), which leads to reading the value stored in memory right after the last element of the array.
Also, you're not adding all the values of the array, but the same value three ties (three because before the fourth there is a comma).
Yeah, I realized it was repeating the first one because of the for (i = 0; i < 4; i++). I think everything looks okay, but is technically in an array because it had to ask four times?