第1个回答 2011-04-14
private function Sum(N as long) as long
dim i as long
for i=1 to n
sum=sum+i
next i
end sub
第2个回答 2011-04-14
'借鉴了anankid的
Private Function Sum(N as long) as Long
Dim i As Long
For i=1 To n
Sum=Sum+i
Next i
End Function
Private Sub Command1_Click()
Msgbox Sum(100)'求1到100的和
End Sub
第3个回答 2011-04-14
Option Explicit
Private Sub Form_Click()
Dim n As Integer, s As Integer, i As Integer
n = 100
For i = 1 To n
s = s + i
Next
Print s
End Sub