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? -

java - How to create Table using Apache PDFBox -

mpi - Why is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages -