Number triangle pattern
Print N rows: row i holds the numbers 1 to i separated by spaces.
Reported in: TCS NQT (14 May 2024) (memory-based)
Input
One line: N.
Output
The N rows of the triangle.
Constraints
1 ≤ N ≤ 50.
Example 1
Input:
4
Output:
1
1 2
1 2 3
1 2 3 4Example 2
Input:
1
Output:
1Hint: An outer loop over the rows and an inner loop printing 1 to the row number.