Below is an algorithm for defining the average of a set of scores. averageArray is double, averageScore is double, but totalScore and numGrades are both integers. Now I know that when an integer is divided by an integer the result is concatenated. It was my believe that by simply expressing them as double values that would remediate the issue. Thus if my average score should be 95.5 it would be expressed that way. However, even doing what I did below still results in 95.0 instead of 95.5. Is there some way that I can make this work the way I would like?

for (int i = 0; i < classSize; i++)

{

totalScore = 0;

for (int j = 0; j < numGrades - 1; j++)

{

totalScore += scoreArray

*[j];*

}

averageScore = double(totalScore) / double(numGrades - 1);

averageArray

}

averageScore = double(totalScore) / double(numGrades - 1);

averageArray

*= averageScore;*

}

}