Hey is there a function that will let me round an int or a double to the nearest 10? Eg say I have 127 I want it rounded to 130, but if its 124 its rounded to 120?
Thanks
Printable View
Hey is there a function that will let me round an int or a double to the nearest 10? Eg say I have 127 I want it rounded to 130, but if its 124 its rounded to 120?
Thanks
um I dunno if you can do it with .NET functions, but here's a simple function I wrote"
it basically devides your number by 10 to make it a decimal number and then rounds it and multiplies backCode:private int toNearestTenth (int num)
{
return (int)(Math.Round(num/10.0)*10);
}
Nice Solution !
Rajib