求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-

求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-

题目
求教一道简单的VB题,直到最后一项的绝对值小于10-5为止.1-1/(1*2)+1/(2*3)-
不知道哪里错了Private Sub Command1_Click()
Dim a As Double,i As Integer,s As Single
f = -1
i = 1
Do
a = 1 / (i * (i + 1))
s = 1 + f * a
i = i + 1
f = -f
Loop Until Abs(a) < 10 ^ (-5)
Print s
End Sub
求教
答案
Private Sub Command1_Click()Dim a As Double,i As Long,s As Singlef = -1i = 1Doa = 1 / (i * (i + 1))s = 1 + f * ai = i + 1f = -fLoop Until Abs(a) < 10 ^ (-5)Print sEnd Sub
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.