Question: java - Write a method that sums all the numbers in the major diagonal in an n x n matrix of double values using the
java - Write a method that sums all the numbers in the major diagonal in an n x n matrix of double values using the following header:
public static double sumMajorDiagonal(double [][] m) Write a test program that first prompts the user to enter the dimension n of an n x n matrix, then asks them to enter the matrix row by row (with the elements separated by spaces). The program should then print out the sum of the major diagonal of the matrix.
SAMPLE RUN:
Enter dimension n of nxn matrix:Enter row0:Enter row 1:Enterrow 2:Enter row 3:17.1
(can have 3 or 4 rows)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
