Private Sub Command1_Click() Me.Refresh Dim x As Integer For x = 2 To 100 If x Mod 2 = 0 Then If prime(x) = 1 Then Print x & " 这是偶数" End If Else If prime(x) = 1 Then Print x & " 这是奇数" End If End If Next x End Sub Function prime(x As Integer) As Integer Dim i As Integer For i = 2 To x - 1 If x Mod i = 0 Then Exit For End If Next i If i >= x Then prime = 1 Else: prime = 0 End If End Function