C program to print diagonal matrix

C program to print diagonal matrix


Output:

Enter the 3 x 3 matrix to print its diagonal matrix

1 2 3
4 5 6
7 8 9
The diagonal matrix for entered matrix is:
1 0 0
0 5 0
0 0 9

Implementation: