pawan chopra wrote:I have a number a let's say 390. I want to find smallest number which is greater than 390 and divisible by 180. Could't think of a good way feeling dumb

**<putting on my math geek hat>**
In terms of available tricks, the number 180 is the product of 9 times 20. From this, we can say that whatever is divisible by 180, is also ...

* divisible by 20. Checking if something is divisible by 20 is simple -- just make sure the units digit is zero and the tens digit is even.

* divisible by 9. Checking if something is divisible by 9 is also simple -- just sum up all the digits, and the sum should be 9. And if the sum is more than one digit, repeat the

test, by summing the digits of the sum.

So, I would start a loop at 400 (which is the smallest number greater than 390 that is divisible by 20), check if it is divisible by 9. If it is divisible by 9, you're done. If not, then add 20 and try again.

Doing this mentally... 400, 420, 440, 460, 480, 500, 520, 540... done.

**The answer is 540.**
**<taking off my math geek hat>**
Henry