c seeking language practice 38-- 3 * 3 matrix diagonal and

#include <stdio.h>
 / * Title: seeking 3 * 3 matrix diagonal and * / 
int main () {
 int I, J, K, T;
 int A [ 3 ] [ 3 ];
 the while ( . 1 ) { 
the printf ( " Please sequentially input matrix number \ n- " ); 
K = 0 ;
 for (I = 0 ; I < . 3 ; I ++ )
     for (J = 0 ; J < . 3 ; J ++ ) 
    Scanf ( " % D " , & A [I] [J]);
 for (I = 0 ; I <. 3 ; I ++ )
     for (J = 0 ; J < . 3 ; J ++ )
     IF (I == J) 
    K = K + A [I] [J];     
the printf ( " diagonal sum and% D   " , K); 
the printf ( " \ n-________________________________ \ n- " ); 
} 
return  0 ; 
}    

 

Guess you like

Origin www.cnblogs.com/gougouwang/p/11444216.html