Find one respectively 5×5 The sum of all rows of the matrix 、 The sum of the columns 、 The sum of the elements on the two diagonals .
Input data , Inconsistent after output
#include<stdio.h>#define M 2int main(){ int i,j,a[i][j],sum; printf(" Please enter each element of the matrix :\n"); for(i=0;i<M;i++){ for(j=0;j<M;j++){ scanf("%d",&a[i][j]); } } printf(" The input matrix elements are :\n"); for(i=0;i<M;i++){ for(j=0;j<M;j++){ printf("%d,",a[i][j]); } printf("\n"); }}
Please enter each element of the matrix :
4 1 4 1
The input matrix elements are :
4,4,
4,1,