1#include <stdio.h>
2#include <stdlib.h>
3
4int main()
5{
6 int N;
7
8 scanf("%d", &N);
9 int pascalArray[N + 1][N + 1];
10 int i, j;
11 if(0 <= N && N <= 20)
12 {
13 for (i = 0; i < N + 1; i++)
14 {
15 for(j = 0; j <= i; j++)
16 {
17 if(j == 0 || j == i)
18 pascalArray[i][j] = 1;
19 else
20 pascalArray[i][j] = pascalArray[i-1][j-1] + pascalArray[i-1][j];
21 if (i == N)
22 printf("%d ", pascalArray[i][j]);
23 }
24 }
25 }
26 return 0;
27}
1def pascal_triangle(n):
2 trow = [1]
3 y = [0]
4 for x in range(max(n,0)):
5 print(trow)
6 trow=[l+r for l,r in zip(trow+y, y+trow)]
7 return n>=1
8pascal_triangle(6)