countrymeister
asked on
Given a number how can I round it to some number with two padded zeros
If I have a number 2495, then this should be rounded to 2400
If I have 6321 , then 6300
123456 , would be 123400
If I have 6321 , then 6300
123456 , would be 123400
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@e_livesay
You need to subtract off the remainder that is left over when you divide by 100.That's exactly what integer division does ; )
@kaufmed
Agreed - the solutions are equivalent. Didn't see your response until I'd written mine.
Agreed - the solutions are equivalent. Didn't see your response until I'd written mine.
@e_livesay
All good. I mistook the "... when you divide by 100" to be pseudo-directed at me = )
All good. I mistook the "... when you divide by 100" to be pseudo-directed at me = )
@kaufmed.
No problem. Wondered if it might look like that after I saw that your post had come in before mine. Not directed at you at all.
No problem. Wondered if it might look like that after I saw that your post had come in before mine. Not directed at you at all.
As e_livesay alluded to, if your stipulation changes (where you have to worry about 10's or 1000's), then you have to make sure to change the equation.
-saige-