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

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

设有如下程序: Private Sub Command1_Click( ) Dim sum As Double,x As Double sum=0 n=0 For i=1 To 5 x=n/i n=n+1 sum=sum+x Next End Sub 该程序通过For循环计算一个表达式的值,这个表达式是

A.1+1/2+2/3+3/4+4/5

B.1+1/2+2/3+3/4

C.1/2+2/3+3/4+4/5

D.1+1/2+1/3+1/4+1/5


参考答案

更多 “ 设有如下程序: Private Sub Command1_Click( ) Dim sum As Double,x As Double sum=0 n=0 For i=1 To 5 x=n/i n=n+1 sum=sum+x Next End Sub 该程序通过For循环计算一个表达式的值,这个表达式是A.1+1/2+2/3+3/4+4/5B.1+1/2+2/3+3/4C.1/2+2/3+3/4+4/5D.1+1/2+1/3+1/4+1/5 ” 相关考题
考题 ( 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

考题 设有如下程序:Private Sub Form_Click()Dim ary(1 To 5)As IntegerDim i As IntegerDim sum As IntegerFor i=1 To 5ary(j)=i+1sum=sum+ary(i)Next 1Print sumEud Sub程序运行后,单击窗体,则在窗体上显示的是A.15B.16C.20D.25

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

考题 设有如下程序: Private Sub Command1_ Click() Dim sum As Double, x As Double sum=0 n=0 For i=1 To 3 x=n/i n=n+1 sum=sum+x Next i End Sub 该程序通过For循环来计算sum的值,sum值的精确结果是( )。A.1+1/2+2/3B.1+1/2+1/3+1C.1/2+2/3D.1/2+1/3

考题 有如下程序: #inCludeiostream using namespaCe std; Class Sample{ friend long fun(Sample S); publiC: Sample(10ng A.{x=a;} private: long X; }; long fun(Sample S){ if(S.x2)return l; return S.X*fun(Sample(s.x-1)); } int main( ) { int sum=0; for(int i=0;i6;i++) {sum+=fun(Sample(i));} Coutsum: return 0; } 执行这个程序的输出结果是( )。A.120B.16C.154D.34

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

考题 11、设有如下程序段,输出结果是()。 int i=0, sum=0; do { sum+=i;i++; }while(i<=4); printf("%d\n", sum);

考题 设有程序如下: i=1; sum=0; while i<=100 sum=sum+i; i=i-1; end 则程序的执行结果为:A.5050B.100C.99D.无限循环,无结果

考题 程序填空,使下面程序实现输出N!(N<=10000)的十进制位数。 #include <stdio.h> #include <math.h> int main () { int i, n; double sum; sum = 0.0; scanf("%d", n); for (i = 2; i <= n; i++) { sum +=_________; } printf ("%dn", (int)ceil(sum)); return 0; }

考题 5、写出如下程序的运行结果和运行原理: sum = 0 n = 99 while n > 0: sum = sum + n n = n - 2 print(sum)