int main(void) /* main function begins execution */
{
int grade[10], counter; /* grade is the array of input grades, counter keeps track of the number of nonzero elements of the array: it's 'size' for our purposes*/
char sentinel; /* a reusability sentinel */
/* printing the welcome message and prompting for input */
printf("Welcome to the automatic grading system:\n");
printf("Do you want to average a student's grade? (y/n) ");
/* inputting the sentinel */
scanf("%c", &sentinel);
/* while our reusability condition is met, repeat the program */
while(sentinel == 'y' || sentinel == 'Y') {
counter = 0;
do {
printf("Enter grade\t");
scanf(" %d", &grade[counter]);
counter++;
printf("counter is %d", counter);
} while(grade[counter - 1] != 0 && counter < 9);
}
return 0;
}