下面代码输出结果是( )。
inti=0,s=0;
do{
if(i%2==0){
i++;
continue;
}
i++;
s=s+i;
}while(i<7);
System.out.println(s);
A、16
B、12
C、28
D、21
第1题:
有如下程序段:
for(inti=i;i<=50;i++){
if(i%3 1=0)continue;
else if(i%5 1=0)continue;
cout<<i<<",";
这个程序的输出结果是______。
第2题:
下列程序段的时间复杂度为()。i=0,s=0;while(sn){s=s+i;i++;}
A、O(n1/2)
B、O(n1/3)
C、O(n)
D、O(n2)
第3题:
如下程序显示的结果是 ( )。
s=1
i=0
do while i<8
s=s+i
i=i+2
end do
s
13
第4题:
下列程序的运行结果是______。
main()
{ int s=0,i=1;
while(s<= 10)
{ s=s+i*i;
i++;
}
printf("%d",-i);
}
第5题:
有以下程序: #include <stdio. h> main ( ) { inti=0.s=0; for(;;) if( i = = 3 ‖ i = = 5 ) continue; if (i ==6) break; i++; s+ =i; } printf(" % d \n" ,s);程序运行后的输出结果是( )。
A.10
B.13
C.21
D.程序进入列循环
第6题:
有以下程序 main( ) { int i=0,s=0; do{ if(i%2){i++;continue;} i++; s+=i; } while(i<7); printf("%d\n",s); } 执行后输出的结果是
A.16
B.12
C.28
D.21
第7题:
下列语句段中不是死循环的是()。
A、intI=100;while(1){I=I0+1;if(I=20)break;}
B、intI;sum=0;for(I=1;;I++)sum=sum+1;
C、intk=0;do{++k;}while(k>=0);
D、ints=3379;while(s++%2+3%2)s++;
第8题:
如下程序显示的结果是 S=1 i=0 do while i<8 s=s+i i=i+2 enddo?s
第9题:
有如下程序 #include(iostream.h> voidmain( ) {charch[2][5]={"6937","8254"),*p[2]; inti,j,s=0; for(i=0;i<2;i++)p[i]=ch[i]; for(i=0;i<2;i++) for(j=0;p[i][j])\0;j+=2) s=10*s+p[i][j]一0; cout<<S;} 该程序的输出结果是( )。
A.69825
B.63825
C.6385
D.693825
第10题:
A、16
B、12
C、28
D、21