c# - Rounding a number with special conditions -


i need create function rounds numbers this:

33120->34000

21001->22000

here no decimal points if there exist number other 1 in last 3 digits 4th digit must incremented , last 3 digits should set 0.

i need optimized, don't want traverse each digit of each number since have on 800,000 number.

thanks in advance!

var result =  math.ceiling((double) x/1000)*1000; 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -