printNumberTriangle 🌶️
Write a method printNumberTriangle that takes an int n (from 1 to 9) and prints n lines. Line 1 is 1, line 2 is 12, line 3 is 123, and so on: line k counts from 1 up to k, with no spaces.
For example, printNumberTriangle(4) prints
1121231234
Line 3 prints 1, 2, 3. What does the inner loop have to count up to, and which variable tells it so?
The inner loop runs
k from 1 up to the current line number and prints k each time. Call println once per line, after the inner loop.