logoStarPatterns
Back to Patterns

Number Increasing Reverse Pyramid

Pattern Result

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Code Implementation

Explanation

The Number Increasing Reverse Pyramid pattern creates an inverted triangle where each row contains numbers starting from 1 and increasing up to the row's maximum value. The pattern starts with the longest row at the top and decreases in length with each subsequent row. The outer loop iterates from n down to 1, representing each row. The inner loop runs from 1 to the current row number, adding the current column number to the row string.