Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2ce5c5e

Browse files
Updated
1 parent 6bfe7cb commit 2ce5c5e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

‎Matrix Addition/matrixAddition.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
x=float(input("number of rows of Matrix A :"))
2+
y=float(input("number of columns of Matrix A:"))
3+
v=[]
4+
k=0
5+
while k < x :
6+
s=[]
7+
j=0
8+
while j < y :
9+
a=int(input("Enter numbers in Rows : "))
10+
s.append(a)
11+
j += 1
12+
v.append(s)
13+
k += 1
14+
15+
16+
g=float(input("number of rows of Matrix B :"))
17+
h=float(input("number of columns of Matrix B :"))
18+
l=[]
19+
m=0
20+
while m < h :
21+
n=[]
22+
o=0
23+
while o < g :
24+
t=int(input("Enter numbers in Rows : "))
25+
n.append(t)
26+
o += 1
27+
l.append(n)
28+
m += 1
29+
30+
31+
if len(v) == len(l) and len(s) == len(n) :
32+
u=0
33+
while u < len(v):
34+
w= 0
35+
while w < len(v):
36+
h=(v[u][w] + l[u][w])
37+
print(h, end=" ")
38+
w += 1
39+
u += 1
40+
print ("\n")
41+
else:
42+
print("Matrix can't add")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /