Write code which prints every number from 1 to 20 a number of times equal to the number itself (e.G. One 1, two 2's...). Every individual number printed should be separated by a space, and there should be a new line each time the number changes. You should use nested loops to produce your output (it will result in far less code).

Respuesta :

Answer:

Answered in Python

for i in range(21):

    for j in range(i):

         print(i, end=' ')

    print(" ")

Explanation:

This iteration iterates from 1 to 20

for i in range(21):

This iteration iterates from 1 to current number

   for j in range(i):

This prints the current number in the a number of times equal to itself

       print(i, end=' ')

This enables printing on new line

   print(" ")