优质解答
Private Sub Form_load()
Dim i As Integer
Dim j As Integer
Dim x As Integer
For i = 2 To 10000
f = 0 ' f 用来标识是否为素数
For j = 2 To Int(Sqr(i))
If i Mod j = 0 Then
f = 1
Exit For
End If
Next j
If f = 0 Then x = x + 1
Next i
MsgBox x
End Sub
Private Sub Form_load()
Dim i As Integer
Dim j As Integer
Dim x As Integer
For i = 2 To 10000
f = 0 ' f 用来标识是否为素数
For j = 2 To Int(Sqr(i))
If i Mod j = 0 Then
f = 1
Exit For
End If
Next j
If f = 0 Then x = x + 1
Next i
MsgBox x
End Sub