Tuesday, December 14, 2010

Rounding to the nearest # in C#.NET

This simple code lets you round to the nearest nth number. In this example it rounds to the nearest 5th.


double free = 100 - (Math.Round(free2 / 5.0) * 5);
            

No comments:

Post a Comment