VB 找出1000以内所有质数的算法
问题描述:
VB 找出1000以内所有质数的算法
答
Private Sub Command1_Click()
For i = 2 To 1000
For j = 2 To i
If i Mod j = 0 Then Exit For
Next j
If j = i Then Print i;
Next i
End Sub