#K32947. Symmetrical Triangle Pattern Generation
Symmetrical Triangle Pattern Generation
Symmetrical Triangle Pattern Generation
Given a positive integer \( n \), generate a symmetrical triangle pattern where each row contains sequential numbers. The first row will contain one number, the second row two numbers, and so on, up to \( n \) numbers in the \( n^{th} \) row. Each row is left padded with spaces so that the triangle appears centered.
For example, when \( n = 3 \), the generated pattern should be:
1 2 3 4 5 6
And for \( n = 5 \), the pattern looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Your task is to implement a function to generate this pattern and write a complete program that reads the input from standard input and prints the pattern to standard output.
inputFormat
The input consists of a single integer \( n \) (\( 1 \le n \le 100 \)) representing the number of rows in the triangle pattern.
outputFormat
Output the triangle pattern with each row on a new line. Each row should have leading spaces to ensure the triangle is centered as described.
## sample3
1
2 3
4 5 6
</p>