Question #206048

Write a program for given m*n matrix find its anti diagonal matrix


Expert's answer

M, N = map(int, input().split())
matrix = [list(map(int, input().split())) for i in range(m)]


maximum_sum = M+ N- 2
for s in range(maximum_sum+1):
    for i in range(s+1):
        if i < M and s - i < N:
            print(matrix[i][s- i], end=" ")
    print()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS