//Program to sort non-boundary elements in square matrix with print diagonal elements of matrix and sum of diagonal elements.
import java.util.Scanner;
class SortNonBoundary
{
Scanner sc=new Scanner(System.in);
int A[][],B[],m,n;
void input()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the size of the square matrix : ");
m=sc.nextInt();
if(m<4 || m>10)
{
System.out.println("Invalid Range");
System.exit(0);
}
else
{
A = new int[m][m];
n = (m-2)*(m-2);
B = new int[n];
System.out.println("Enter the elements of the Matrix : ");
for(int i=0;iB[j])
{
c = B[i];
B[i] = B[j];
B[j] = c;
}
}
}
}
void printArray()
{
for(int i=0;i