Dimentrix interview question

Program for Addition of diagonal elements of Matrix