什么是VB啊,你们有没有教等差数列啊。有公式可以算的:S=na [n*(n 1)]/2,a是第一个数,n是项数,这题是500吧
Private Sub Command1_Click()
For i = 1 To 999 Step 2
Sum = Sum + i
Next i
Print Sum
End Sub
Dim a As Single, i As Single
i = (999 + 1) / 2 * (1 + 999)
MsgBox i
Dim s As Integer,i As Integer
s=0
i=1
Do
s=s+i
i=i+2
Loop Until i>999
Print "S=1+3+5+7+...+999=";s