Don't know if I said that right but well...
thanksCode:number = 42
//what I want to is to bring number to 50
if number would have been 23 --> 30
19-->20
60-->60
Printable View
Don't know if I said that right but well...
thanksCode:number = 42
//what I want to is to bring number to 50
if number would have been 23 --> 30
19-->20
60-->60
Think it through. You're doing this based off of being divisible by 10. Hence, find out if the number is divisible by 10... ie. num % 10.
If the result of that is not zero, that means you want to round it up. So how much do you want to round it by? 42 -> 50, 23 -> 30, 19 -> 20, and 60 -> 60. Notice the amount in each and every case? ;)
Just add that amount to the original number.
it's random number, these numbers were just example...but I think I've got it
It doesn't matter what the number itself is. I was trying to give you a forumula to do it. BTW, it's only one line of C code to do what you're asking to do. ;)
something along the lines of:
Code:rounded_number = (number % ... != ... ) ? ((number / ...) + ...) * ... : number