Kotlinlearncs.online LogoJava
Return to List

Homework: Round Sum

Imported By: Geoffrey Challen
/ Version: 2021.7.0

For this problem, we'll round an int value up to the next multiple of 10 if its rightmost digit is 5 or more, so 15 rounds up to 20. Alternately, round down to the previous multiple of 10 if its rightmost digit is less than 5, so 12 rounds down to 10. Given three positive ints, return the sum of their rounded values. Complete and use the private helper method round10 and use it to perform the rounding so that you don't need to repeat the same code three times.

Related Lessons

Stuck? You may find these lessons helpful: