int a{1,2,3,4,5,6,7,8,9},k,s=0;for(k=0,k

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 20:38:53
inta{1,2,3,4,5,6,7,8,9},k,s=0;for(k=0,kinta{1,2,3,4,5,6,7,8,9},k,s=0;for(k=0,kinta{1,2,3,4,5,6,7,8,9

int a{1,2,3,4,5,6,7,8,9},k,s=0;for(k=0,k
int a{1,2,3,4,5,6,7,8,9},k,s=0;for(k=0,k

int a{1,2,3,4,5,6,7,8,9},k,s=0;for(k=0,k
*(a+k)其实就相当于指针;指向a[k];
k=0时,执行第一次循环 s=s+a[0]=0+1=1; 然后k=k+2;K=2;
k=2时,执行第二次循环 s=s+a[2]=1+3=4; 然后k=k+2;K=4;
k=4时,执行第三次循环 s=s+a[4]=4+5=9; 然后k=k+2;K=6;
k=6时,执行第四次循环 s=s+a[6]=9+7=16; 然后k=k+2;K=8;
因为k=8时,不满足条件k