下列哪种循环语句可以求6,8,10,12,…,66数列的和,结果存放在sum变量中 A: i=6 sum=0 while i<67: if i%2==0: sum=sum+i i=i+1 B: i=6 sum=1 while i<67: if i%2==0: sum=sum+i i=i+1 C: i=6 sum=0 while i<=66: sum=sum+i i=i+2 D: i=6 sum=0 while i<=66: sum=sum+i i=i+2
下列哪种循环语句可以求6,8,10,12,…,66数列的和,结果存放在sum变量中 A: i=6 sum=0 while i<67: if i%2==0: sum=sum+i i=i+1 B: i=6 sum=1 while i<67: if i%2==0: sum=sum+i i=i+1 C: i=6 sum=0 while i<=66: sum=sum+i i=i+2 D: i=6 sum=0 while i<=66: sum=sum+i i=i+2
中国大学MOOC: 下面程序执行后的输出结果是( )。#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue;
中国大学MOOC: 下面程序执行后的输出结果是( )。#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue;
下面程序执行后的输出结果是()。#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;}#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;}#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;}#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;} A: 10 B: 13 C: 21 D: 死循环
下面程序执行后的输出结果是()。#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;}#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;}#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;}#includeintmain(){inti=0,s=0;for(;;){if(i==3||i==5)continue;if(i==6)break;i++;s+=i;};printf("%d",s);return0;} A: 10 B: 13 C: 21 D: 死循环
下面程序运行后,输出结果是( )。#include ;main( ){ int a[10]={1,2,3,4,5,6},i,j; for(i=0;i { j=a[i];a[i]=a[5-i];a[5-i]=j;} for(i=0;i}[/i][/i] A: 1 5 4 3 2 6 B: 1 5 3 4 2 6 C: 6 5 4 3 2 1 D: 1 2 3 4 5 6
下面程序运行后,输出结果是( )。#include ;main( ){ int a[10]={1,2,3,4,5,6},i,j; for(i=0;i { j=a[i];a[i]=a[5-i];a[5-i]=j;} for(i=0;i}[/i][/i] A: 1 5 4 3 2 6 B: 1 5 3 4 2 6 C: 6 5 4 3 2 1 D: 1 2 3 4 5 6
以下程序段实现的输出是()。for(i=0;i<;=9;i++)s[i]=i;for(i=9;i>;=0;i--)printf("%2d",s[i]);[/i][/i] A: 9 7 5 3 1 B: 1 3 5 7 9 C: 9 8 7 6 5 4 3 2 1 0 D: 0 1 2 3 4 5 6 7 8 9
以下程序段实现的输出是()。for(i=0;i<;=9;i++)s[i]=i;for(i=9;i>;=0;i--)printf("%2d",s[i]);[/i][/i] A: 9 7 5 3 1 B: 1 3 5 7 9 C: 9 8 7 6 5 4 3 2 1 0 D: 0 1 2 3 4 5 6 7 8 9
下列程序的运行结果为( )。Private Sub Command1_Click() Dim a(5) As String Dim i As Integer For i = 0 To 5 a(i) = i + 1 Print a(i); Next iEnd Sub A: 123456 B: 6 C: 1 2 3 4 5 6 D: 0
下列程序的运行结果为( )。Private Sub Command1_Click() Dim a(5) As String Dim i As Integer For i = 0 To 5 a(i) = i + 1 Print a(i); Next iEnd Sub A: 123456 B: 6 C: 1 2 3 4 5 6 D: 0
对于下面的程序段,输出的结果是:int x=10,y=5;switch(x){case 12:y=y+5;case 10:y++;case 8: y=y-2;case 6: y=y*2;default: y=0;}System.out.println(y); A: 5 B: 0 C: 6 D: 8
对于下面的程序段,输出的结果是:int x=10,y=5;switch(x){case 12:y=y+5;case 10:y++;case 8: y=y-2;case 6: y=y*2;default: y=0;}System.out.println(y); A: 5 B: 0 C: 6 D: 8
【单选题】以下哪个循环并非重复 5 次? A. inti; for (i=1; i<6; i++) {} B. inti; for (i=0; i<5; i++) {} C. inti; for (i=0; i<=5; i++) {} D. inti; for (i=1; i<=5; i++) {}
【单选题】以下哪个循环并非重复 5 次? A. inti; for (i=1; i<6; i++) {} B. inti; for (i=0; i<5; i++) {} C. inti; for (i=0; i<=5; i++) {} D. inti; for (i=1; i<=5; i++) {}
下列程序的执行结果是( ).for i in range(2): print(i,end=' ' )for I in range(4,6): print(I,end=' ' ) A: 2 4 6 B: 0 1 2 4 5 6 C: 0 1 0 1 2 3 D: 0 1 4 5
下列程序的执行结果是( ).for i in range(2): print(i,end=' ' )for I in range(4,6): print(I,end=' ' ) A: 2 4 6 B: 0 1 2 4 5 6 C: 0 1 0 1 2 3 D: 0 1 4 5
【单选题】以下程序的输出结果是: void main() { int i,j,n,a[5]={3,4,1,2,-6}; for(i=0;i<5;i++) for(j=i+1;j<5;j++) if(a[j]<a[i]) { n=a[j];a[j]=a[i];a[i]=n; } for(i=0;i<5;i++) printf("%3d",a[i]); printf(" "); } A. 3 4 1 2 -6 B. 4 3 2 1 -6 C. -6 1 2 3 4 D. 4321-6
【单选题】以下程序的输出结果是: void main() { int i,j,n,a[5]={3,4,1,2,-6}; for(i=0;i<5;i++) for(j=i+1;j<5;j++) if(a[j]<a[i]) { n=a[j];a[j]=a[i];a[i]=n; } for(i=0;i<5;i++) printf("%3d",a[i]); printf(" "); } A. 3 4 1 2 -6 B. 4 3 2 1 -6 C. -6 1 2 3 4 D. 4321-6