#K69307. Generate Pascal's Triangle
Generate Pascal's Triangle
Generate Pascal's Triangle
Given an integer N, generate the first N rows of Pascal's Triangle. Each element in the triangle is defined by the formula \(C(n,k) = \frac{n!}{k!(n-k)!}\). If \(N \le 0\), output nothing.
For example, when \(N=5\), the triangle is:
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
inputFormat
The input consists of a single integer N provided via STDIN, denoting the number of rows to generate.
outputFormat
Output the Pascal's Triangle rows, each row on a new line. Within a row, numbers are separated by a single space. If no rows are generated (i.e. when \(N \le 0\)), output nothing.
## sample5
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
</p>