How to divide integers without division/multiplication/modulo
The theory of division
When we divide an integer (D) by another integer (E), we obtain a quotient (Q) and remainder ®. Q represents the number of times that E occurs in D; in simpler terms, Q is the number of parts, of size E, that D can be broken into. Once all of these parts are taken out of D, the remaining part is the remainder.
We have a bar of length 11
1 of 3
Algorithm and code
By this point, you should have realized that the quotient can be found by repeatedly subtracting E from D, and recording the number of times that this subtraction is performed.
def Divide(D,E):R = DQ = 0while R >= E:R = R - EQ += 1return QD = 11E = 4print("Quotient from our function: ",Divide(D,E))print("Actual Quotient: ", D // E)
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved