Calculate the Sum of Diagonals in a Matrix Write a program to calculate the sum of the main and secondary diagonals in a square matrix.