Private Sub Command1_Click()
Dim i As Integer, c As Integer, n As Integer
n = Val(Text1.Text)
c = 0
For i = 1 To n
If i Mod 3 = 0 Then c = c + 1
Next i
Label1.Caption = Str(c)
End Sub
运行该程序,在文本框Text1中输入20,单击命令按钮Command1,在标签Label1中显示的是。
微信扫码预览、分享更方便