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

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

设有如下程序: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 i End Sub 该程序通过For循环来计算一个表达式的值,这个表达式是______。

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

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

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

D. 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 i End Sub 该程序通过For循环来计算一个表达式的值,这个表达式是______。A.1+1/2+2/3+3/4+4/5B. 1+1/2+1/3+1/4+1/5C. 1/2+2/3+3/4+4/5D. 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 Form. Click( )Dim ary(1 To 5)As IntegerDim i As IntegerDim sum As IntegerFor i=1 To 5ary(i)=i+lsum=sum+ary(i)Next iPrint sumEnd Sub程序运行后,单击窗体,则在窗体上显示的是( )。A.15B.16C.20D.25

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

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

考题 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.无限循环,无结果

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

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