Does anyone know how to round up a number to its nearest multiple of 5? I found an algorithm to round it to the nearest multiple of 10 but I can\'t find this one.
T
int roundUp(int n, int multipleOf) { int a = (n / multipleOf) * multipleOf; int b = a + multipleOf; return (n - a > b - n)? b : a; }
source: https://www.geeksforgeeks.org/round-the-given-number-to-nearest-multiple-of-10/