Divide two numbers without using / or % and return quotient.
Anonymous
You have a counter and then subtract the divisor from the dividend and add one to the counter. You repeat this until subtracting gives you a negative number. The quotient is whatever your counter is up to and the remainder is whatever the dividend is up to. 16/3: 16-3=13 | counter = 1 13-3=10 | counter = 2 10-3=7 | counter = 3 7-3=4 | counter = 4 4-3=1 | counter = 5 1-3=-2 | counter = 5 (number is too low so we don't increment counter. Instead the quotient is 5 and the remainder is 1)
Check out your Company Bowl for anonymous work chats.