4.自然对数的底数e的级数表示形式为:e=1+1/1!+1/2!+1/3!+......+1/n!+…,将下列程序补充完整求e的近似值,其中绝对值小于1E-8的项被忽略。 Private Sub Form_Click() Dim i%, n%, t!, k!, e! e = 1 k = 1 n = 【1】 Do While 【2】 e = e + k n = n + 1 【3】 For i = 1 To n t = t * i Next i k = 【4】 Loop Print e End Sub
举一反三
- 声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub
- 程序填空:程序采用选择法对数组元素进行从大到小排序。请将题目[填空]处的内容补充完整,使程序完成指定的功能。Private Sub Command1_Click() Dim iA(1 To 6),i%,j%,k%,n% n = 6 iA(1) = 8: iA(2) = 6: iA(3) = 9: iA(4) = 3: iA(5) = 2: iA(6) = 7 For i = 1 To n - 1 k=i For j = ______ To n If iA(j) > iA(k) Then ______ End If Next j t = iA(i) ______ iA(k) = t For m = 1 To n Print iA(m); Next m Print Next iEnd Sub答案2: 答案3:
- 下面____程序段不能正确显示1!、2!、3!、4!的值。 A: For I=1 To 4 n=1 For j=1 to I n=n*j Next j Print n Next I B: For I=1 To 4 For j=1 to I n=1 n=n*j Next j Print n Next I C: n=1 For j=1 to 4 n=n*j Print n Next j D: n=1:j=1 Do While j<=4 n=n*j Print n j=j+1Loop
- 下列程序运行后输出结果是_______. Private Sub Form_Click() K=1 For I=5 to 1 step -1 T=T*10 + K S=S+T Next I Print S End sub
- 1 Complete the words. ► k n i c k e r s knickers 1 _ n d _ r w _ _ r ____ 2 m _ t _ r _ _ l ____ 3 s l _ _ v _ ____ 4 t i _ _ t s ____ 5 s _ _ d e ____ 6 n _ c k l e ____ 7 b l _ _ s e ____ 8 e a _ _ i n s ____ 9 v _ _ t ____ 10 b _ _ t t _ n ____