printf("\n主对角线元素和=%d\n",m);for(i=0;i<3;i++){for(j=0;j<=i;j++)n=n+a[i][j];} printf("下三角元素和=%d\n",n);} 你试试