generate functionWed, 08 Feb 2023

Write a program that prints the maximum element in the area below the main diagonal including the diagonal of the square matrix.

#input: # 3 # 1 2 3 # 4 5 6 # 7 8 9 # output: # 18 n = int(input()) matrix = [list(map(int, input().split())) for _ in range(n)] result = 0 for i in range(n): for j in range(n): if i + j >= n: break result += matrix[i][j] print(result)

Questions about programming?Chat with your personal AI assistant