generate functionFri, 10 Feb 2023

Write a program that prints the maximum element of a square matrix whose elements are entered from the keyboard, below the main diagonal. The elements of the main diagonal are also taken into account.

n = int(input("Enter the value of n: ")) def max_of_matrix(n): matrix = [] sum = 0 for i in range(n): a = [] for j in range(n): a.append(int(input())) matrix.append(a) for i in range(n): for j in range(n): if i < j: sum += matrix[i][j] return sum print(max_of_matrix(n)

Questions about programming?Chat with your personal AI assistant