Thread: algorithms help
View Single Post
Old 04-23-2008, 12:44 AM   #3 (permalink)
joblow11
Registered User
 
Join Date: Dec 2007
Posts: 7
OS: XP


Re: algorithms help

Your question reeks of homework. But here's the answer to the first question.

public void printGradeInfo(int[] grades)
{
double min = max = averageSum = 0;
for (int i = 0; i < grades.length; i++)
{
if (min > grades[i])
{
min = grades[i]
}
if (max < grades[i])
{
max = grades[i]
}
averageSum += grades[i]
}
Console.WriteLine(min);
Console.WriteLine(max);
Console.WriteLine(averageSum/grades.length);
}
joblow11 is offline   Reply With Quote