Home > My Notebook > Development > Rounding to nearest X
3 October 2011
An interesting forumla to remember for rounding numbers to the nearest X.
Int32 value = 43.7; Int32 toNearest = 5; Int32 result = Math.Round(value / toNearest) * toNearest;
Tagged as C#, Maths