While2. The positive numbers A and B (A > B) are given. On the segment of length A, the maximum possible number of segments of length B (without overlays) is placed. Without using the operations of multiplication and division, find the number of segments B placed on the segment A.

Solution in Python 3:

import random

A = random.randrange(50,100)
B = random.randrange(1,A)
print('A = ', A)
print('B = ', B)

r = A - B
n = 1
while r > B:
r -= B
n += 1
print("Number of Bs in A: ", n)
print("Remainder: ", r)