How do I find the next multiple of 10 of any integer?

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2010-03-08T18:19:53Z Indexed on 2010/03/08 18:51 UTC
Read the original article Hit count: 185

Filed under:
|
|

Dynamic integer will be any number from 0 to 150.

i.e. - number returns 41, need to return 50. If number is 10 need to return 10. Number is 1 need to return 10.

Was thinking I could use the ceiling function if I modify the integer as a decimal...? then use ceiling function, and put back to decimal?
Only thing is would also have to know if the number is 1, 2 or 3 digits (i.e. - 7 vs 94 vs 136)

Is there a better way to achieve this?

Thank You,

© Stack Overflow or respective owner

Related posts about c

    Related posts about math