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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -