if 不是循环语句
If i <= 10 Then
s = s + i * i
i = i + 1
End If
改成
While i <= 10
s = s + i * i
i = i + 1
Wend
没有循环呀 改成这样
Private Sub Form_Click()
Dim s As Integer
Dim i As Integer
s = 0
i=1
do while i <= 10
s = s + i * i
i = i + 1
loop
Print s
End Sub
'要用一个小小的循环体才能实现呢
Private Sub Form_Click()
Dim s As Integer
Dim i As Integer
s = 0
For i = 1 To 10
s = s + i * i
Next
Print s
End Sub
将“s = 0
i = 1
If i <= 10 Then
s = s + i * i
i = i + 1
End If”
改为“
s=0
for i=1 to 10 step 1
s=s+1*i
next i
”