How to write the sum of diagonal elements of 3 * 3 plastic matrix in C language
//sum is the sum of diagonal elements —————————————————————————————————————————————————————. stdio.h # include & ltstring void main(){ int a[3][3]; int i,j; //i is row j and column intsum = 0; int sum 1 = 0; //Enter for(I = 0;; I < = 2; i++){ for(j = 0; j & lt=2; J++){printf (please enter the number in row %d and column %d:, i+ 1, j+1); scanf (%d,& ampa[I][j]); } printf(\ n); }//Sum for(I = 0; I < = 2; i++){ for(j = 0; j & lt=2; j++){ if(I = = j)sum = sum+a[I][j]; if(I+j = = 2)sum 1 = sum 1+a[I][j]; }}//Output and print f (sum of diagonal lines from left to right %d\n, sum); Printf (sum of diagonal lines from right to left %d\n, sum1); //diagonal sum; //Output matrix printf (\ n);