Given a positive number N, compute R, the NEAREST multiple of X.
Note: Nearest multiple means that if N is already a multiple of X, don't move up to next multiple. This is kind of like rounding; e.g., round to $47 to the nearest $5. If already a multiple of $5, leave it alone.
example #1: Given 47, compute the nearest multiple of 5, which is 50.
example #2: Given 50, compute the nearest multiple of 5, which is 50.
n = 47
x = 5
rem ... r = ((n + x + 1) \ x) * x
R = int((N+X-1)/X)*X 'Corrected by Moneo 02Nov06
Credits: Moneo, Agamemnus.