c=int(input("enter no.of columns:")) r=int(input("enter no.of rows:")) print("enter 1st matrix elements") m1=[] for i in range (r): print("enter elemnts of row",i+1) n=[] for j in range (c): x=int(input()) n.append(x) m1.append(n) print("enter 2nd matrix elements") m2=[] for i in range (r): print("enter elemnts of row",i+1) n=[] for j in range (c): x=int(input()) n.append(x) m2.append(n) for i in range (r): for j in range (c): a=m1[i][j] b=m2[i][j] x=a+b print(x,end=" ") print(" ")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter