Rounding Up To The Nearest Hundred
Take advantage of integer division, which truncates the decimal portion of the quotient. To make it look like it’s rounding up, add 99 first. int rounded = ((num + 99) / 100 ) * 100; Examples: 801: ((801 + 99) / 100) * 100 → 900 / 100 * 100 → 9 * 100 = … Read more