网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下程序:: 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. 12

B.30

C.24

D.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 i Print sum End Sub 程序运行后,单击窗体,输出结果为______。A. 12B.30C.24D.18 ” 相关考题
考题 ( 35 )有如下程序::#includeusing namespace std:class Sample{friend long fun ( Sample s ) ;public:Sample ( long a ) {x=a;}Private:long x;};long fun ( Sample s ){if ( s.x2 ) retum 1;retum s.x*fun ( Sample ( s.x-a ))}int main (){int sum=0for ( int i =0; i 6; i ++ ) { sum+=fun ( Sample ( i ) ; ) }coutSUM;retum 0;}运行时输出的结果是A ) 120B ) 16C ) 154D ) 34

考题 有如下程序 gincludevoid main(){char ch[2] [5]={”6937","8254"),*p[2];int i,j,S 有如下程序 #ginclude<iostream.h> void main() {char ch[2] [5]={”6937","8254"),*p[2]; int i,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.69825B.63825C.6385D.693825

考题 以下能够正确计算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

考题 以下能够正确计算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

考题 在窗体上画一个命令按钮,然后编写如下程序: Option Base 1 Private Sub Command1 Click() Dim Arr1(12)As Integer, Arr2(3)As Integer Dim Sum As Integer Sum = 2 For i=1 To 12 Arrl(i)= i Next i For i=1 To 3 Arr2(i)= Arrl(i*i) Next i For i = 1 To 3 Sum = Sum + Arr2(i) Next i Print Sum End Sub 程序运行后,单击命令按钮,在窗体上的输出结果为A.16B.24C.32D.36

考题 有如下程序 includeviodmain() {int i,sum=0;for(i=1;i 有如下程序 #include<iostream.h> viod main() { int i,sum=0; for(i=1;i<=3;sum++) sum+=i; cout<<sum<<end1; } 该程序的执行结果是 ______。A.6B.3C.死循环D.0

考题 若有以下程序段,sum和i都是整型变量,则不能与下面程序段等价的选项是() sum=0; i=2; while(i<=10) { sum=sum+i; i++; }A.for(i=2, sum=0; i<=10; i++) sum+=i;B.sum=0; i=2; do{ sum=sum+i; i++; }while(i<=10);C.sum=0; i=10; while(i>1) { sum=sum+i; i--; }D.sum=0; i=11; do{ sum=sum+i; i--; }while(i>1);

考题 如下程序中实现sum=1+2+3+...+n的程序是A.int sum=0,i; for(i=0;i<n;i++)sum+=i;B.int sum=0,i; for(i=0;i<n;i++); sum+=i;C.int sum=0,i; for(i=1;i<=n;i++); sum+=i;D.int sum=0,i; for(i=1;i<=n;i++) sum+=i;

考题 如下程序段执行后sum的值为() int i,sum; i=1; sum=0; while(i<=5) { sum+=i; i++; }A.5B.10C.15D.20

考题 已定义整型变量i和sum,与以下程序段功能一样的程序有()。 sum=0; for(i=1;i<=100;i++)sum+=i;A.sum=0;i=1;for(; i<=100;i++) sum+=i;B.sum=0;for(i=1;i<=100;){i++;sum+=i;}C.sum=0;for(i=1;i<=100;) sum+=i;i++;D.sum=0;for(i=1;;i++ )