I have a amount 100001, i want to round it up to nearest 10000. my expected output after roundup would be 110000.
How to do that using c#??
I have a amount 100001, i want to round it up to nearest 10000. my expected output after roundup would be 110000.
How to do that using c#??
I believe this works given the test case:
double RoundUp(double value, double factor) {
return Math.Ceiling(value / factor) * factor;
}
Usage:
var answer = RoundUp(100001, 10000);
Answer:
110000