如何判断一个数是否为素数的算法(VB) 谢谢啊!!!!!
来源:百度知道 编辑:UC知道 时间:2024/05/10 21:35:37
Function ss(Tmp As Long) As Boolean '素数判断
ss = True
For i = 2 To Tmp / 2
If Tmp Mod i = 0 Then
ss = False
Exit Function
End If
Next
End Function
Private Sub Command1_Click()
Dim a As Long
For a = 10 To 100 '小一点 从10到 100吧!
If ss((a))Then
Print a
End If
Next
End Sub