Private Sub Command1_Click()
Dim a As Integer, b As Integer
flag = ""
For a = 100 To 200
b = 2
Do While a Mod b <> 0
b = b + 1
Loop
If b = a Then flag = flag + CStr(a) + " "
If Len(flag) = 40 Then
Form1.Print flag
flag = ""
End If
Next
End Sub
Function flag(x As Integer) As Boolean
Dim i As Integer
For i = 2 To x - 1
If x Mod i = 0 Then
Exit For
End If
Next i
If i >= x Then
flag = True
Else
flag = False
End IfEnd Function
Private Sub Command1_Click()
Dim x As Integer
For x = 100 To 200
If flag(x) Then
Print x;
End If
Next x
End Sub