Sum of main diagonal elements of a matrix in python


 

Sum of main diagonal elements of a matrix

In [1]:
Enter the number of rows of the matrix: 3
Enter the number of columns of the matrix: 3
Enter the elements of the matrx: 
3
4
5
4
5
6
5
6
7
The entered matrix is: 
3 4 5 
4 5 6 
5 6 7 
Sum of main diagonal elements of the matrix is: 
15

No comments:

Post a Comment