s=1+1/2+1/3+……+1/100 P=3+6+9+……+27+30+31+41+51+……+91
问题描述:
s=1+1/2+1/3+……+1/100 P=3+6+9+……+27+30+31+41+51+……+91
要用for语句的,while语句不行.
答
给s的VB代码:
Private Sub Command1_Click()
Dim i As Long
Dim s As Double
For i = 1 To 100
s = s + 1 / i
Next
Debug.Print s
End Sub