求出1-500之间的素数,要求按行输出,每行输出5个数。
发布网友
发布时间:2024-10-21 14:36
我来回答
共1个回答
热心网友
时间:2024-11-12 16:42
Private Sub Command1_Click()
Dim i As Integer, j As Integer, n As Integer
For i = 2 To 500
For j = 2 To Sqr(i)
If i Mod j = 0 Then Exit For
Next j
If j > Sqr(i) Then
Print Tab((n Mod 5) * 10); i;
n = n + 1
If n Mod 5 = 0 Then Print
End If
Next i
End Sub
next i