If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.
__________________________________________________

Continuously subtracting is not such an effective way to go. Instead, we can do it like this:
mul = int(number/divisor);
remainder = number – mul * divisor;