logoStarPatterns
Back to Patterns

Number Changing Pyramid

Pattern Result

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

Code Implementation

Explanation

The Number Changing Pyramid pattern creates a triangle where each position contains a number that increases sequentially throughout the entire pattern. The pattern starts with 1 and continues incrementing for each position. The outer loop iterates from 1 to n, representing each row. The inner loop runs from 1 to the current row number, adding the current value of 'num' to the row string and then incrementing 'num'.