Triangle Pattern with numbers
Hi I'm trying to do a triangle pattern, I've done this before but I'm really lost for how to do it with incrementing numbers.
e.g.,
1
12
123
1234
...
Code:
public static void drawPattern(int n)
{
// loop N times, one for each row
for (int i = 0; i < n; i++) {
// print j *
for (int j = 0; j < i; j++)
System.out.print("*");
// print a new line
System.out.println();
}
Could someone give me a heads up on how I could change this code to make it with numbers?
Any information would be greatly appreciated!