素数也就是大于1且只有1和它本身能整除的整数.
Private Sub Command1_Click()
Dim i As Integer,j As Integer
Dim sum As Integer,f As Boolean
For i = 2 To 100
For j = 2 To i - 1
If i Mod j = 0 And i 2 Then
f = True
Exit For
End If
Next
If Not f Then sum = sum + i
f = False
Next
MsgBox sum
End Su