Do you remember doing long division at school? For example 56473/27 might be done as:
Code:
__2091_
27 ) 56473
54
--
247
243
---
43
27
--
16
56473/27=2091 r 16
So one way is to code up this algorithm. Another way is to shift and subtract, e.g.
56473/27
part 1:
27>56473? no: shift left and repeat (should that be > or >=?)
270>56473? no: shift left and repeat
2700
27000
270000>56473? yes: shift right
part 2:
27000>56473? no: subtract
56473
27000-
=====
29473
27000>29473? no: subtract (leaves 2473)
27000>2473? yes: shift right
2700>473? yes: shift right
270>2473? no: subtract
270>2203? no: subtract
270>1933? no: subtract
270>1663? no: subtract
270>1393? no: subtract
270>1123? no: subtract
270>853? no: subtract
270>583? no: subtract
270>313? no: subtract
270>43? yes: shift right
27>43? no: subtract
27>16? yes: can't shift right any more so this ends the loop.
This doesn't show where you get the answer (2091) from, but maybe you can figure that bit out?