Did not read the Read first guidelines. Title was unacceptable. Also I shortened the code so that it only includes the lines with functions. I am sorry.

Any help or advice given will be of great assistance. Thank you beforehand.

Written in C lang., the code is used to get the average test scores as the user inputs them. The tricky part is that the program is written to eliminate only the lowest score. How can I change it so it eliminates any amount of test scores the user wishes to eliminate?



// establish when the while loop will end. Enter a -1.
while (ExamValue >= -0.1){

printf ("\n\n\t Exam's Value: ");
scanf ("%lf",&ExamValue);
//Loop occurs along with the while. Used to indicate the proper arrays and the addition of the elements within the arrays
if (ExamValue > -0.1){
printf ("\n\n\t Student's grade: ");
scanf ("%lf",&Garray[a]);
Earray[a] = ExamValue;
a++;
}
}
if(a != 1){
int x,y;
//here the elements spaces reserved in memory are reduced to the proper amount. Initially there are 200 elements in memory.
for(x = 0; x < a; x++){
//loop that continues until the elements of x are less one element of a.
if((Garray[x]/Earray[x]) < temp){
temp = (Garray[x]/Earray[x]);
y = x;
}
}
while(a > -1){
if(a != y){
StudentGradeTotal += Garray[a];
ExamValueTotal += Earray[a];
}
a--;
}
}else{
while(a > -1){
StudentGradeTotal += Garray[a];
ExamValueTotal += Earray[a];
a--;
}
}
if (ExamValueTotal > 0){
Average = StudentGradeTotal/ExamValueTotal * 100;
}
else{
printf ("\n\n\t The Exam's Value is 0.\n\n\t Therefore there is no grade for the student.\n\n\t " );
return 0;
}