Find maximum element in each column of a matrix

 m=int(input("number of rows"))

n=int(input("number of coulmns"))

a=[]

for i in range(m):

    a.append([int(j) for j in input().split()])  


for i in range(n):

    large=a[0][i]

    for j in range(m):

        if a[j][i]>large:

            large=a[j][i]

    print(large)

        


No comments:

Post a Comment