?
=?ISO-8859-1?Q?G=F6ran_Andersson?=
hi there,
Divide the value by five, round it to the nearest integer, then multiply
it by five.
Example:
double x = 147.24
int y = (int)Math.Round(x / 5.0) * 5;
(This will of course round the number to 145, not 150 as you used in
your example.)
any help with this one? i have say, numbers which i'd like to be rounded to
the nearest 5 or 10, example:
147.24 -->>150
181.99 -->> 180
824.18 -->>825
822.49 -->>820
and so on.. is there anything that i can do this right away in .net or would
i have to somehow create my own little rounding function for this?
thanks,
Paul
Divide the value by five, round it to the nearest integer, then multiply
it by five.
Example:
double x = 147.24
int y = (int)Math.Round(x / 5.0) * 5;
(This will of course round the number to 145, not 150 as you used in
your example.)