10、以下程序的输出结果是:_______。 sum=1 for i in range(1,5): sum *= i print(sum)A.24B.120C.10D.15
10、以下程序的输出结果是:_______。 sum=1 for i in range(1,5): sum *= i print(sum)
A.24
B.120
C.10
D.15
参考答案和解析
无定值 for(i=1;i<7;i++)决定了循环次数为6次,每次执行的操作是Sum+=i,但由于sum没有初始化,并不知道sum的初值是多少,所以结果无定值.
相关考题:
以下程序的输出结果是 【 8 】 。#includestdio.hmain(){int i,j,sum;for(i=3;i=1;i--){sum=0;for(j=1;j=i;j++) sum+=i*j;}printf("%d\n",sum);}
有如下程序: 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
以下程序的输出结果是【 】。include main() {int i,j,sum; for(i=3;i>=-1;i-) (sum=0; fo 以下程序的输出结果是【 】。include<stdio.h>main(){int i,j,sum;for(i=3;i>=-1;i-)(sum=0;for(j=1;j<=i;j++) sum+=i*j;}printf("%d\n,sum);}
设有以下程序:main(){int i,sum=0;for(i=2;i<10;i++){ if((i%2)==0)continue;sum+=i;}printf("%d\n",sum);}程序执行后的输出结果是( )。
有以下程序: void sum(int *A) { a[0] =a[1]; } main ( ) { int aa[10]={1,2,3,4,5,6,7,8,9,10}, i; for (i=2 ;i>=0;i--) sum(aa[i] ); print f ("%d\n",aa[0]); } 执行后的输出结果是A.4B.3C.2D.1
下列程序段的输出结果是【】。 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;}
以下程序的输出结果是【】。 include using namespace std; int main(){ int sum,i; for( 以下程序的输出结果是【 】。include<iostream>using namespace std;int main(){int sum,i;for(sum=0,i=1;i<5;i++)sum+=i;cout<<sum<<endl;return 0;}
下列程序的输出结果是______。 #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
有如下程序: 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
以下程序的输出结果是#include stdio.hmain(){ int i,j,sum; for(i=5;i=1;i--) { sum=0; for(j=i;j=i;j++) sum+=i*j; } printf("%d\n",sum);}
运行下列程序: 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
有以下程序: void sum(int * a) {a[0]=a[1];} main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; for(i=1;i>0;i--)sum(aa[i]); print("%d\n",aa[0]); } 程序运行后的输出结果是 ______。A.4B.3C.2D.1
有以下程序: include using namespace std; int main() {int i=1,sum=0;Loop:if(i 有以下程序:include<iostream>using namespace std;int main(){int i=1,sum=0;Loop:if(i<=20){sum+=i;i++;goto Loop;}cout<<sum<<end1;return 0;}该程序运行后的输出结果是【 】。
下列程序运行后的输出结果是______。Private Sub f(k,s) s = 1 for j = 1 To k s=s*j Next jEnd SubPrivate Sub Command1_ Click () Sum = 0 for i = 1 To 3 Call f(i, s) Sum = Sum + s Next i Print Sum End SubA.0B.3C.6D.9
阅读下列程序: 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
以下能够正确计算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
以下程序输出结果是 ______。includevoid main(){ int a[3][3]={1,3,5,7,9,10,13,1 以下程序输出结果是 ______。 #include<iostream.h> void main(){ int a[3][3]={1,3,5,7,9,10,13,15,17},sum=0,i,j; for(i=0;i<3:i++) for(j=0;j<3;j++){ a[i][j]=i+j; if(i= =j)sum=sum+a[i][j]; } cout<< "sue="<<sum; }A.15B.25C.6D.9
以下程序段的执行结果是______。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、运行出现错误
单选题有以下程序#includemain(){ inti,sum; for(i=1;i6;i++)sum+=i; printf(%d,sum);}程序运行后的输出结果是( )。A0B随机值C15D16