以下程序输出的结果是。#include int main(){int a[4][4]={{1,2,0,-1},{3,-2,-3,0},{4,0,-5,5},{-6,6,0,7}};int i,j,s=0;for(i=0;i<4;i++)for(j=0;j<4;j++){if(a[i][j]<0) continue;if(a[i][j]==0)break;s+=a[i][j];}printf("%d\n",s);return 0;}
以下程序的输出结果是。#include int main(){int i,n[4]={1};for(i=1;i<=3;i++){n[i]=n[i-1]*2+1;printf("%d",n[i]);}return 0;}
以下程序运行时,输出结果第一行是,第二行是。#include #define N 4int main(){int a[5]={5,3,2,1};int i=3,j,k=6;while(i>0 && k>a[i])i--;for(j=N-1;j>=i;j--){a[j+1]=a[j];}a[j+1]=k;for(i=0;i<=N;i++){if(a[i]%2 ==0)printf("%3d\n",a[i]);}return 0;}
以下程序运行时,输出结果中第一行是,第二行是。#include int main(){int a[4][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20};int sum1,sum2,i,j;for(sum1=0,sum2=0,i=0;i<4;i++){for(j=0;j<4;j++){if(i==j)sum1+=a[i][j];if(i+j==3)sum2+=a[i][j];}}printf("sum1=%d\n",sum1);printf("sum2=%d\n",sum2);return 0;}