精华 | |
金钱 | BA |
威望 | 点 |
贡献值 | 点 |
爱心 | 点 |
经验 | 点 |
注册时间 | 2009-11-6 |
最后登录 | 1970-1-1 |
在线时间 | 小时 |
| |
| |
| |
|
百度吧,挺多的,这是第一个的
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Me.Show
j = 0
For i = 3 To 100
If IsPrime(i) = True Then
j = j + 1
Me.Print i,
End If
If j Mod 4 = 0 Then
Me.Print
End If
Next
End Sub
Private Function IsPrime(intNum As Integer) As Boolean
Dim i As Integer
For i = 2 To intNum \ 2
If (intNum Mod i) = 0 Then
IsPrime = False
Exit Function
End If
Next
IsPrime = True
End Function |
|