编程实现,求200∽300间的所有素数,并将素数存入数组a中,并每行输出4个

2025-03-25 19:55:14
推荐回答(1个)
回答1:

Private Function IsPrime(ByVal n As Integer) As Boolean
        Dim pb As Integer
        pb = n - 1
        IsPrime = True
        For i = 2 To pb
            If n Mod i = 0 Then
                IsPrime = False
                Exit For
            End If
        Next i
End Function