Given a positive number N, compute R, the NEXT multiple of x.
Example #1: Given 47, compute the next multiple of 5 after 47: 50.
Example #2: Given 50, compute the next multiple of 5, after 50: 55.
Three ways to do it:
r = 47
x = 5
r = (1 + n \ x) * x: PRINT r
r = n - n MOD x + x: PRINT r
r = ((n + x) \ x) * x: PRINT r
However, the following is the original algorithm that I developed, and the only one that I have tested.
R = int((N+X)/X)*X
Credit: Moneo, Agamemnus.