The goal for this exercise is to give you more opportunities to practice writing nested loops.
What you need to do to prepare for this exercise:
In the starter project, add code to the the Square_Of_Numbers
class, so that the RunExercise
method produces the output described here.
Write your code so that RunExercise
asks the user for how many columns they want printed (which
we’ll call
N
here). RunExercise
should then display the following pattern:
1 2 3 4 … N 1 2 3 4 … N 1 2 3 4 … N ….
(There are a total of N rows of output)
As one specific example, if the user chose '5' for the number of columns, then you should produce
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
(i.e,. a 5x5 grid of numbers, where each line counts from 1 to 5)
Hint: You will need to use nested loops for this.