Option Explicit
Private Sub Form_Click()
Dim i As Long, j As Long, n As Integer, prime() As Integer
For i = 1 To 100
If fc(i) Then
n = n + 1
ReDim Preserve prime(1 To n)
prime(n) = i
End If
Next
For i = 1 To n
Print prime(i);
If i Mod 10 = 0 Then Print
Next
Print: Print "共有:" & n
End Sub
Function fc(a) As Boolean
Dim i As Long
For i = 2 To Int(a / 2)
If a Mod i = 0 Then Exit For
Next
If i = Int(a / 2) + 1 Then fc = True
End Function