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).

Partial sample run:

1
2 2
3 3 3
........

Note: Java

Respuesta :

public class JavaApplication71 {

   

   public static void main(String[] args) {

       for (int i = 1; i <= 20; i++){

           for(int w = 0; w < i; w++){

               System.out.print(i+" ");

           }

           System.out.println("");

       }

   }

   

}

I hope this helps!

The program is an illustration of loops

Loops are used to perform repetitive operations.

The program in Java is as follows:

Comments are used to explain each line

public class Main {

   public static void main(String[] args) {

       //This iterates from 1 to 20

       for (int i = 1; i <= 20; i++){

           //This iterates from 1 to i

           for(int j = 1; j <= i; j++){

               //This prints i, i-times

               System.out.print(i+" ");

           }

           //This prints a new line

           System.out.println("");

      }

  }

}

At the end of each iteration, each number is printed repeatedly.

Read more about similar programs at:

https://brainly.com/question/14689712