88.4k views
1 vote
JAVA 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
........

User Fordio
by
7.8k points

1 Answer

3 votes

I've included my code in the picture below. Best of luck.

JAVA Write code which prints every number from 1 to 20 a number of times equal to-example-1
User JanBorup
by
6.7k points