Private Sub Command1_Click()
Dim i, j, a, n As Integer
Text1.Text = ""
Text2.Text = ""
Randomize
For i = 1 To 10
a = Int(Rnd * 90) + 10
Text1.Text = Text1.Text & a & " "
For j = 2 To a - 1
If a Mod j = 0 Then Exit For
Next
If j = a Then Text2.Text = Text2.Text & a & " ": n = n + 1
Next
Label1.Caption = "素数的个数=" & n
End Sub
温馨提示:答案为网友推荐,仅供参考