2013-02-04, 07:11 PM
[SPOILER="I don't have a Java compiler installed so I did a test in C, success"]
Code:
#include <stdio.h>
int main()
{
int c[10] = {90, 100, 88, 76, 92, 83, 75, 93, 78, 89};
int total = 0;
double finalGrade;
int high = c[0];
int low = c[0];
for (int i = 0; i < 10; i++)
{
int grade = c[i];
if (grade > high)
high = grade;
else if (grade < low)
low = grade;
total += grade;
}
total -= high + low;
finalGrade = total/8.0;
printf("total %d\n", total);
printf("finalGrade %.2f\n", finalGrade);
printf("high %d\n", high);
printf("low %d\n", low);
return 0;
}
//output:
//total 689
//finalGrade 86.12
//high 100
//low 75
