task 16 Average of an array I dont get why this rounding doesnt work

Back to Problem Solutions forum

Mr Monstr     2015-01-17 15:32:51

This is the answer I got: 1806 4523 3615 424 629 6914 492 4137 299 4618

This is the answer I apparently need: 1807 4524 3616 424 629 6914 493 4138 300 4618

As you can see some of them are right and some of them are one more than they should be. I've tried using Math.round aswell as my own rounding algorithm that I used for a previous rounding task (if less than .5 convert to int, else convert to int+1)

I'm not using floor or ceiling. I'm programming in java.

Mr Monstr     2015-01-17 17:18:17

fixed it now. The data types messed me up.

Please login and solve 5 problems to be able to post at forum