Question: Write a method that sums all the numbers in the major diagonal in an n * n matrix of double values using the following header:public
Write a method that sums all the numbers in the major diagonal in an n * n matrix of double values using the following header:public static double?sumMajorDiagonal(double[][] m)Write a test program that reads a 4-by-4 matrix and displays the sum of all its elements on the major diagonal. Here is a sample run:
Enter a 4-by-4 matrix row by row: 1 2 3 4.0 - Enter 5 6.5 7 8 - Enter 9 10 11 12 -Enter 13 14 15 16 Sum of the elements in the major diagonal is 34.5 JEnter
Step by Step Solution
3.51 Rating (171 Votes )
There are 3 Steps involved in it
Output Enter a 4by4 matrix row by row 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S... View full answer
Get step-by-step solutions from verified subject matter experts
