#include <stdio.h>
#include <stdlib.h>
int main()
{int i,j,s1=0,s2=0,a[4][4];
for(i=0;i<4;i++)
{for(j=0;j<4;j++)
{a[i][j]=rand()%10; //或者使用scanf("%d",&a[i][j]);
printf("%4d",a[i][j]);
}
printf("\n");
s1+=a[i][i];
s2+=a[i][3-i];
}
printf("\ns1=%d\ns2=%d\n",s1,s2);
return 0;
}