用VB编写计算S=1-1/2+1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10
1个回答
2014-04-04
展开全部
Private Sub Command1_Click()
Dim i As Integer, s As Double
s = 0
For i = 1 To 10
s = s + (-1) ^ (i - 1) * (1 / i)
Next i
Print 0; s
End Sub
Dim i As Integer, s As Double
s = 0
For i = 1 To 10
s = s + (-1) ^ (i - 1) * (1 / i)
Next i
Print 0; s
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询