C program to print diagonal elements of matrix

C program to print diagonal elements of matrix

Output:

Enter the elements of matrix:
1 2 3
4 5 6
7 8 9
The diagonal elements of the matrix are:
1 5 9

Implementation: