Implement a division algorithm in your favourite language which handles integer division. It need only handle positive numbers - but bonus points if it handles negative and mixed-sign division, too. Results are rounded down for fractional results.
The program may not contain the
div or similar operators. It must be a routine which does not use native division capabilities of the language.
You only need to handle up to 32-bit division. Using repeated subtraction is not allowed.
Take two inputs on stdin separated by new lines or spaces (your choice)
In this case, the output would be
The solution which is the shortest wins.