Given a 2-d square matrix of order ‘n’, find the sum of elements of both diagonals and all boundaries elements. Boundary elements refer to the elements present on all the four boundaries of matrix.
Can anyone code this in java ? Size of array will be always N*N .
Here given 5*5 array
8 18 18 1 10
12 3 13 6 19
17 11 18 10 19
10 13 12 11 14
3 1 19 11 1
output : 232
I have solved this ,here is the solution
import java.util.Scanner;
public class Main {
}