Imagine simple math problem. You have a number, say it's 1000. And you want to find the next multiple of 32 that follows 1000. You automatically make some simple calculations and get the result. Typical algorithm looks like this:
int number = 1000, result; result = (1 + (number/32)) * 32; // integer division
It's kind of easy and obvious, right? And now the challenge. Make this calculation without using
/ and loops.
- Don't use
- Assume that input number is already stored in variable
n, store result in the variable
- The shortest code wins.
Sample input: (already stored in
Sample output: (value of
It is assumed that
n is a positive number.