0 votes

As we know, the arithmetic is really accomplished in base 2. This can lead to some slight differences in decimal digits. Add to that the "banker's rounding" and some strange differences occur.

I saw this same difference earlier today in another student's program. The student with this difference had initialized the totals to zero before the loop and added the initial populations after the loop before dividing to compute the average.

Instead, I initialized the totals to the initial populations before the loop.

That made a difference in the fourth decimal digit and rounding to 3 decimal places made the third decimal digit different.

Check to see how you initialized the accumulating total variables before the loop.