Using basic c++, write 2 separate codes for the assignment
1. (Sum the major diagonal in a matrix) Write a method that sumsall the num in the major diagonal in an n X n matrix of doublevalues using the following header:
public static double sumMajorDiagonal (double [ ] [ ] m)
Write a test program that reads a 4-by-4 matrix and displays thesum of 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 *ENTER*
Sum of the elements in the major diagonal
OR
OR