Use an indefinite loop. Loop the statement that asks the user for grades until the user personally terminates the loop, then go on to find the average.
Have an incrementing variable to count the number of entries.
for example, in pseudocode
Code:
i = 1
numEntries = 0
input = 0
while i == 1
{
if input != "done"
{
ask the user to input values, and type in "done" when they have all the values
}
else
{
i = 2; //set i to two so the loop terminates
}
numEntries = numEntries + 1 //increment a value, this will be how many entries there are
}