' 判断素数用不着 j = 1 To i - 1 的循环
' 因为超过【根号 i 】以后的判断与【根号 i 】以前的判断都是重复或无用的
Dim i As Integer, j As Integer, k As Integer, PD As Boolean
Text1 = ""
For i = 101 To 300 Step 2
k = Sqr(i) : PD = True
For j = 2 To k
If i Mod j = 0 Then
PD = False : Exit For
End If
Next j
If PD Then
Text1.Text = Text1.Text & " " & i
End If
Next i