Pascal's triangle
Problem
Pascal's triangle is constructed as follows. The first line consists of a single number equal to one. Each next
The
contains one number more than the previous one. The first and last of these numbers are equal to 1, and all the rest are calculated as the sum of the number above it in the previous line and the number to the left of it in the previous line.
Input: input one number N
(\(0<=N< ;=30\)).
Output: output N
lines of Pascal's triangle. Separate numbers in a line with a single space.
Note
All numbers in Pascal's triangle under the specified restrictions are included in Longint.
Examples
# |
Input |
Output |
1 |
8 |
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
|