sum of diagonal elements of a matrix in c