Private Sub Command1_Click()
Dim k As Integer, i As Integer
Dim m
k = 0
For m = 999 To 100 Step -1
i = 2
Do While m Mod i <> 0 '判断是否是素数
i = i + 1
Loop
If i = m Then '是素数
Print m
k = k + 1
If k = 3 Then Exit For
End If
Next m
End Sub
------------------------分割线---------------------------------
Private Sub form_load()
Me.AutoRedraw = True
e = 1
For i = 999 To 100 Step -1
d = 0
For a = 2 To i
If i Mod a = 0 Then
Exit For
Else
d = d + 1
End If
Next
If d = i - 2 Then
Print i
e = e + 1
If e = 4 Then Exit Sub
End If
Next
End Sub
------------------------分割线---------------------------------