15、下列程序运行后,屏幕上打印的值是___________。 sum = 0 i = 1 while sum < 10: if i % 2 != 0: sum += i print(sum)
15、下列程序运行后,屏幕上打印的值是___________。 sum = 0 i = 1 while sum < 10: if i % 2 != 0: sum += i print(sum)
参考答案和解析
10
相关考题:
有如下程序: Private Sub Form_Click() Dimi As Integer,sumASInteger sum=0 For i=2To 10 If i Mod2<>0 And i Mod 3=0 Then sum=sum+i End If Nexti Print sum EndSub 程序运行后,单击窗体,输出结果为( )。A.12B.30C.24D.18
有如下程序: Private Sub Form_Click() Dim i As Integer,Sum As Integer Sum=0 For i=2 To 10 If i Mod 2<>0 And i Mod 3=0 Then Sum=Sum+i End If Next Print Sum End Sub 程序运行后,单击窗体,输出结果为A.12B.30C.24D.18
以下程序的运行结果是()。main(){inti=1,sum=0;while(i10)sum=sum+1;i++;printf(“i=%d,sum=%d“,i,sum);}A、i=10,sum=9B、i=9,sum=9C、i=2,sum=1D、运行出现错误
下列程序运行后,单击窗体,输出结果为( )。 Private Sub Form_Click() Dim i As Integer, sum As Integer sum = 0 For i = 2 To 10 If i Mod 2 <> 0 Andi Mod 3 = 0 Then sum = sum + i End If Next i Print sum End Sub A. 12B. 18C. 24D. 30
阅读下列程序: Function func(n As Integer)As Integer Sum = 0 For i = 1 To n Sum = Sum + (i + 1)* i Next i func = Sum End Function.Private Sub Command1_Click () Dim a As Integer a= 5 s = func (A)Print s End Sub 程序运行后,单击命令按钮,输出的结果为A.80B.60C.70D.15
设有以下程序:main(){int i,sum=0;for(i=2;i<10;i++){ if((i%2)==0)continue;sum+=i;}printf("%d\n",sum);}程序执行后的输出结果是( )。
下列程序段的输出结果是【】。 include void main() {inti=10,sum=0;do{sum=+sum+i;i=i 下列程序段的输出结果是【 】。include<iostream.h>void main(){int i=10,sum=0;do{sum=+sum+i;i=i-2;}while(i>=2);cout<<sum<<end1;}
有如下程序,可以得到0到100之间所有偶数之和。 DIM I AS INTEGER DIM SUM AS INTEGER SUM = 0 FOR I =0 TO 100 STEP 2 SUM = SUM + I NEXT I DEBUG. PRINT I DEBUG. PRINT SUM 程序运行后,变量I和SUM的值是( )。A.100和2450B.102和2550C.104和2650D.106和2850
以下C程序的运行结果为______。main(){ int i=1,sum=0; loop:if(i<=10) { sum+=i; i++; goto loop; } printf("sum=%d\n",sum);}A.sum=10B.sum=55C.sum=100D.sum=88
下列程序的输出结果是______。 #define A 100 main() { int i=0,sum=0; do{ if(i=(i/2)*2)continue; sum+=i; }while(++i<A); print("%d\n",sum); }A.2500B.2050C.4D.0
以下程序执行后sum的值是 ______。 main() { int i,sum; for(i=1;i<6;i++)sum+=i; printf("%d\n",sum); }A.15B.14C.不确定D.0
有如下程序: Private Sub Form_Click( ) Dim i As Integer, Sum As Integer Sum = 0 For i = 2 To 10 If i Mod 2=0 And i Mod 3<>0 Then Sum = Sum + i End If Next Print Sum End Sub 程序运行后,单击窗体,输出结果为A.12B.30C.24D.18
以下程序执行后sum的值是( )。 main { int i,sum; for(i=1;i6;i++)sum+=i: printf("1%d\n",sum): }A.15B.14C.不确定D.0
运行下列程序: Private Sub Form. Click() Sum=0 For i=1 To 100 If Mid(CStr(i),1, 1)="1" Then Sum=Sum+1 End If Next i Print Sum End Sub 单击窗体后,在窗体上显示的结果是A.12B.13C.14D.15
有如下程序:: Private Sub Form. Click() Dim i As Integer,sum As Integer sum=0 For i=2 To 10 If i Mod 2 <>0 And i Mod 3=0 Then sum=sum+i End If Next i Print sum End Sub 程序运行后,单击窗体,输出结果为______。A. 12B.30C.24D.18
有如下程序: Option Base 1 Private Sub Form. Click() Dim arr,Sum Sum=0 alt=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)\3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为______。A. 25B.26C.27D.28
有如下程序: Private Sub Form_Click() Dim i As Integer, Sum As Integer sum=0 For i=2 To 10 If i Mod 2<>0 And i Mod 3=0 Then sum=sum+i End If Next i Print sum End Sub 程序运行后,单击窗体,输出结果为______。A.12B.30C.24D.18
以下能够正确计算1+2+3+…+10的程序是A.Private Sub Command1_Click() Sum=0 ForI=1 To 10 Sum=Sum+I Next I Print Sum End SubB.Private Sub Command1_Click() Sum=0,I=1 Do While I<=10 Sum=Sum+I I=I+1 Print Sum End SubC.Private Sub Command1_Click() Sum=0: I=1 Do Sum=Sum+I I=I+1 Loop While I<10 Print Sum End SubD.Private Sub Command1_Click() Sum=0: I=1 Do Sum=Sum+I I=I+1 Loop Until I<10 Print Sum End Sub
阅读程序: Option Base 1 Private Sub Form. Click() Dim arr,Sum Sum= 0 arr=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)\3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为A.13B.14C.27D.15
下列程序的输出结果是______。 #define A 100 main() { int i=0,sum=0; do{ if(i==(i/2)*2) continue; sum+=i; }while(++i<A) ; printf("%d\n",sum);A.2500B.2050C.4D.0
阅读下列程序: Private Sub Form Click() Dim i As Integer, sum As Integer For i = 2 To 10 If i Mod 2 <> 0 Then Print i; Else sum = sum + i End If Next i Print sum End Sub 程序运行后,单击窗体,在窗体上的输出结果是A.3 5 7 9 30B.1 3 5 7 9C.2 4 6 8 20D.11 15 17 19 20
有如下程序: Private Sub Form_CHck() Dim i As Integer,sum As Integer sum=0 For i=2 TO 10 If Mod 2 <>And i Mod 3=0 Then sum=sum+i End If Next i Print sum End Sub 程序运行后,单击窗体,输出结果为______。A.12B.30C.24D.18
以下能够正确计算1+2+3+…+10的程序是A.Private sub Command1_Click( ) sum=0 For 1=1 To 10 Sum=sum+1, Next I Print Sum End SubB.Private sub Command1_Click( ) Sum=0,I=1 Do While l<=10 Sum=Sum+1 I=I+1 Print Sum End SubC.Private Sub command1_click( ) Sum=0:I=1 Do Sum=Sum+1 I=I+1 Loop While I<10 Print Sum End SubD.Private Sub command1_Click( ) Sum=0:I=1 Do Sum=Sum+1 l=I+1 Loop Until I<10 Print Sum End Sub
以下程序段执行结果是(57)。 Int s=0 i=1; Do {s+=i++;} While(i<=10); ConsolA.wrfteline(“sum={0}”,sum)B.Sum=54C.sum=lD.sum=55E.sum=56
以下程序段的执行结果是______。int s=0,i=1;do{ S+=i++;}while(i<=10);Console.WriteLine("sum={0}",sum);A.sum=54B.sum=1C.sum=55D.sum=30
以下程序的运行结果是(). main() { int i=1,sum=0; while(i10) sum=sum+1;i++; printf("i=%d,sum=%d",i,sum); }A、i=10,sum=9B、i=9,sum=9C、i=2,sum=1D、运行出现错误
以下程序执行后sum的值是()。 main(){ int i,sum; for(i=1;i6;i++) sum+=i; printf("%d/n",sum); }A、15B、14C、不确定D、0