设有如下程序段,则输出结果为k=。 int k = 0,a; for (a = 1; a <= 1000; a++) k = k + 1; printf("k = %d", k);
举一反三
- 下面程序段的输出结果是______。int a=-1,b=4,k;k=(a++<=0)&&(!b--<=0);printf("%d,%d,%d",k,a,b);
- 设有如下程序,则程序的输出结果是( ) int k=1,s=0; while(s<10) {s=s+k*k;k++;} printf("%d",k);
- 如下程序段: int c[]={1, 7, 12}; int *k; k=c; printf('next k is %d',*++k); 其输出应为: A: next k is 2 B: next k is 12 C: next k is 7 D: next k is 1
- 运行下列程序的输出是 。 main() {int k=1; {int k=2; printf("%d",k);} printf("%d",k); }
- 现有如下程序段: #include"stdio.h" main() {int k[30]={12,324,45,6,768,98,21,34,453,456}; int count=0,i=0; while(k[i]) {if(k[i]%2==0||k[i]%5==0)count++; i++;} printf("%d,%d\n",count,i);} 则程序段的输出结果为.