Private Sub Form_Click()
Dim n As Integer,s As Integer
n = 0
s = 0
Do While 1
n = n + 1
s = s + (-1) ^ (n - 1) * n * (n + 1) * (n + 2)
Print n,(-1) ^ (n - 1) * n * (n + 1) * (n + 2)
If Abs(s) > 500 Then
Exit Do
End If
Loop
Print "s=",s
End Sub
Private Sub Form_Click()
Dim n As Integer,s As Integer
n = 0
s = 0
Do While 1
n = n + 1
s = s + (-1) ^ (n - 1) * n * (n + 1) * (n + 2)
Print n,(-1) ^ (n - 1) * n * (n + 1) * (n + 2)
If Abs(s) > 500 Then
Exit Do
End If
Loop
Print "s=",s
End Sub