Back to Patterns
Number Triangle Pattern
Pattern Result
12 23 3 34 4 4 45 5 5 5 5
Code Implementation
Explanation
The Number Triangle Pattern creates a triangle where each row contains the row number repeated as many times as the row number itself. For example, row 3 contains three 3's. The outer loop iterates from 1 to n, representing each row. The inner loop runs from 1 to the current row number, adding that number to the current row string.