top of page
Click here to go to the home page of AskTheCode.

Print the sum of rows of a matrix.

Team ATC

Asked: Anonymously |Category: Python

 

n1=input(" Enter the dimension of matrix: ")

n1=int(n1)

n=[]

l=[0]*n1

c=0

for i in range(0,n1):

new=[]

for j in range(0,n1):

new.append(0)

n.append(new)

for i in range(0,n1):

l=[int(i) for i in input().split(" ")]

for j in range(0,n1):

n[i][j]=l[j]

for i in range(0,n1):

c=0

for j in range(0,n1):

c=c+n[i][j]

print("Sum of row number {0} is {1}".format(i+1,c))

Recent Posts

See All

ความคิดเห็น


bottom of page