#K72432. Right-Aligned Number Triangle
Right-Aligned Number Triangle
Right-Aligned Number Triangle
Given an integer \(n\), your task is to print a right-aligned number triangle of height \(n\). For each row \(i\) (where \(1 \le i \le n\)), print the numbers from 1 to \(i\) separated by a single space. The row should be padded with leading spaces so that the numbers are right-aligned.
For example, when \(n = 4\), the output should be:
1 1 2 1 2 3 1 2 3 4
Note: The alignment is based on the formula where each line is right-justified to a width of \(n + i - 1\) characters.
inputFormat
A single integer (n) representing the height of the triangle. The input is provided via standard input (stdin).
outputFormat
A right-aligned triangle of numbers, where the (i)th line (1-indexed) displays numbers from 1 to (i) separated by spaces. Each line is printed on a new line to standard output (stdout).## sample
4
1
1 2
1 2 3
1 2 3 4
</p>