题目内容

8-22有如下程序main(){int a[3][3]={{1,2},{3,4},{5,6}}, i, j, s=0;for(i=1;i<3;i++)for(j=0;j<=i;j++)s+=a[i][j];printf("%d\n",s);}该程序的输出结果是________。

A. 18
B. 19
C. 20
D. 21

查看答案
更多问题

8-23以下程序的输出结果是________。main(){int i,x[3][3]={9,8,7,6,5,4,3,2,1};for(i=0;i<3;i+=1)printf("%5d",x[1][i]);}

A. 6 5 4
B. 9 6 3
C. 9 5 1
D. 9 8 7

8-24以下程序的输出结果是_________。main(){int i,x[3][3]={1,2,3,4,5,6,7,8,9};for(i=0;i<3;i++)printf("%d,",x[i][2-i]);printf("\n");}

A. 1,5,9,
B. 1,4,7,
C. 3,5,7,
D. 3,6,9,

8-25以下程序的输出结果是________。main(){int a[3][3]={{1,2,3},{3,4,5},{5,6,7}},i,j,s=0;for(i=0;i<3;i++)for(j=i;j<3;j++)s+=a[i][j];printf("%d\n",s);}

A. 26
B. 36
C. 19
D. 22

8-26下面程序的输出是________。main(){int aa[3][3]={{2},{4},{6}};int i, p=aa[0][0];for(i=0;i<2;i++){if(i==0)aa[i][i+1]=p+1;else++p;printf("%d",p);}}

A. 23
B. 26
C. 3
D. 36

答案查题题库