For40. Given integers A and B (A < B). Print all integers from A to B inclusive; The number A should be output 1 time, the number A + 1 should be output 2 times, and so on.

Solution in Python 3:

import random

A = random.randrange(1,11)
B = random.randrange(A+1,21)

print("A = ",A)
print("B = ",B)
print()

K = 1
for i in range(A,B+1):
for j in range(0,K):
print(i,end=" ")
print()
K += 1