I am trying to work out the average of 15 gymnasts by taking away the maximum and minimum of their scores from their TOTAL scores and then dividing this by the number of judges (5). I keep getting the wrong output though and it seems that there is an error with numbers somewhere. I have attached the file where the data is being read from.
float CalculateGymnastScore (float JudgesScores[], int Judges)
{
float Sum, Max, Min, FinalScore;
int i;
int Temp;
Sum=0;
Max=GetMaxScore(JudgesScores, NO_OF_JUDGES);
Min=GetMinScore(JudgesScores, NO_OF_JUDGES);
for(i=0;i<NO_OF_JUDGES;i++)
Sum+=JudgesScores[i];
Temp=Max+Min;
FinalScore=Sum-Temp/Judges;
return(FinalScore);
}
float GetMaxScore(float JudgesScores[], int Judges)
{
int Counter;
int Max;
Max=0;
for(Counter=0;Counter<Judges;Counter++)
{
if(JudgesScores[Counter]>Max)
Max=JudgesScores[Counter];
}
return(Max);
}
float GetMinScore(float JudgesScores[], int Judges)
{
int Counter;
int Min;
Min=100;
for(Counter=0;Counter<NO_OF_JUDGES;Counter++)
{
if(JudgesScores[Counter]<Min);
Min=JudgesScores[Counter];
}
return(Min);
}
***THANKS FOR YOUR HELP***