8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f12f2c commit 577449fCopy full SHA for 577449f
algorithms/math/pascal_matrix.py
@@ -0,0 +1,21 @@
1
+# Credit : LyFromQixing a.k.a QueenLy
2
+# Date : 12 November 2021
3
+# Description : A program that accepts N input and writes a Pascal's triangular matrix of size N*N.
4
+
5
+def pascal_matrix(N):
6
7
+ # Creating Pascal's Triangular Matrix
8
+ matrix = [[1 for i in range(N)] for j in range(N)]
9
+ for i in range(1, N):
10
+ for j in range(1, N):
11
+ matrix[i][j] = (matrix[i-1][j] + matrix[i][j-1])
12
13
+ # Showing matrix
14
+ for i in range(N):
15
+ print()
16
+ for j in range(N):
17
+ print(matrix[i][j], end=" ")
18
19
+N = int(input("Insert N: "))
20
21
+pascal_matrix(N)
0 commit comments