Question
Print Number Triangle Pattern with Spaces

You are given a positive integer N.

Your task is to print a number triangle pattern where:

  • The pattern contains N rows.
  • The number printed in each row is equal to the row number.
  • Each number in a row is separated by a single space.
  • The count of numbers in a row is equal to the row number.
Input
A single integer N.
Output
Print the number triangle pattern exactly as shown.
Example
Input
5

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


Explanation
In the 1st row, the number 1 is printed once.
In the 2nd row, the number 2 is printed twice, separated by spaces.
In the 3rd row, the number 3 is printed three times.
This continues until the Nth row.
Each number in a row is separated by a single space.
No extra spaces are printed at the end of any line.

Online