- 935 名前:デフォルトの名無しさん mailto:sage [2008/06/18(水) 19:17:15 ]
- >>850
#include <stdio.h> #define ROW 10 #define COL 5 int main(void){ int row[COL]={0},tr,tc[COL]={0},r,c; for(c=0; c<=COL; c++) printf("\t"); printf("合計\n"); // 各行 for(r=ROW; r>0; r--) { for(c=COL-1; c>=0; c--) { row[c]=r*COL-c; tc[c]+=row[c]; } for(c=0,tr=0; c<COL; c++) { tr+=row[c]; printf("\t%d",row[c]); } printf("\t%d\n",tr); } // 各列の合計 printf("合計"); for(c=0; c<COL; c++) printf("\t%d",tc[c]); puts(""); return 0; }
|

|