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

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

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

考题 有如下程序: include using namespace std; class Sample { frien 有如下程序: #include <iostream> using namespace std; class Sample { friend long fun(Sample s); public: Sample(long a) {x=a;} private: long x; }; long fun(Sample s) { if(s.x < 2) return 1; return s.x * fun(Sample(s.x-1)); } int main() { int stun = 0; for (int i=0; i<6; i++) {sum += fun(Sample(i));} cout << sum; return 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

考题 有如下程序 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

考题 已知程序如下,该程序实现的功能为_____。 main() { int i,n; long sum = 0, p = 1; ...//输入n值的语句,略 for(i = 1; i <= n; i++) { p = p * i; sum = sum + p; } ...//输出sum值的语句,略 }A.sum = 1!+2!+...+n!B.sum = 1*2*3*...*nC.sum = 1+2+3+...+nD.sum = 1*2+2*3+(n-1)*n

考题 若有以下程序段,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);

考题 已知程序如下,该程序实现的功能为_____。 main() { int i,n; long sum = 0, p = 1; ...//输入n值的语句,略 for(i = 1; i <= n; i++) { p = p * i; sum = sum + p; } ...//输出sum值的语句,略 }A.sum = 1*2*3*...*nB.sum = 1!+2!+...+n!C.sum = 1+2+3+...+nD.sum = 1*2+2*3+(n-1)*n

考题 14、已知程序如下,该程序实现的功能为____。 main() { int i,n; long sum = 0, p = 1; ...//输入n值的语句,略 for(i = 1; i <= n; i++) { p = p * i; sum = sum + p; } ...//输出sum值的语句,略 }A.sum = 1*2+2*3+(n-1)*nB.sum = 1+2+3+...+nC.sum = 1*2*3*...*nD.sum = 1!+2!+...+n!

考题 如下程序中实现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