dim i as integer,j as integer
dim b as boolean
for i=2 to 100
b=true
for j=2 to int(sqrt(i))
if i mod j=0 then b=false:exit for
next
if b then print i & " "
next
Private Sub Command1_Click()
Dim n As Integer
For n = 1 To 100
If 求素数(n) Then List1.AddItem n
Next n
End Sub
Public Function 求素数(x As Integer) As Boolean
求素数 = True
For i = 2 To x - 1
If x Mod i = o Then
求素数 = False
Exit For
End If
Next i
End Function