Integer5. The positive integers A and B (A> B) are given. On the segment of length A, the maximum possible number of segments of length B (without overlays) are placed. Using the operation of taking the remainder of the integer division, find the length of the unoccupied part of the segment A.

Solution in Python 3:

import random

A = random.randrange(1,100)
B = random.randrange(1,A)
print("A = ", A)
print("B = ", B)
x = A%B
print("The length of the unoccupied part of the segment A: ", x)

Solution in C++:

#include <iostream>
using namespace std;
int main(){
int a,b;
cout << "Enter A: ";
cin >> a;
cout << "Enter B: ";
cin >> b;
cout << "The length of the unoccupied part of the segment A: " << a%b;
return 0;
}