We need a triangle of numbers, so let us focus on the aspects of content of the pattern and shape of the pattern one by one. We know that we need the shape of a triangle like we created with stars, so let us first give our pattern a shape first, and then think about what the contents of that pattern should be.

java; true";

The above program will provide us with the required shape "star-filled". Now that we have dealt with the shape issue, let us move on to the content analysis.

Up until now, we have been initializing outer loop iterator 'i' as 1 and running it until it was equal to input value n. Now, we make a slight change to it and understand why.

[1,5] ?? means 5 objects (1,2,3,4,5)

[0,5) ?? also means 5 objects (0,1,2,3,4) ?? so 'i' = 0 to i< n will still display 'n' rows

In this program, we are going to start 'i' from 0 to less than n. We also start 'j' from 0 but run it till less than or equal to 'i' only because for each row, the number of columns is one more than row number. The output shows symmetry in the elements it prints. First and last entry on each row is '1'. We know that ??0?? = 1 = ??????.

Integrating this formula into our code;