<HTML>
<HEAD>
<TITLE>Finding Average Grades</TITLE>
</HEAD>
<BODY>
<H1>Finding Average Grades</H1>
<%
double grades[] = {8, 9, 7, 6, 5, 4};
double sum, average;
sum = 0;
for (int i = 0; i < grades.length; i++) {
sum += grades[i];
}
average = sum / grades.length;
out.println("Average grade = " + average);
%>
</BODY>
</HTML>
|