第1个回答 2011-09-03
Option Explicit
Dim S() As Long
Function HZS(ByVal n As Long)
ReDim S(n) As Long
Dim Tmp1 As Long, Tmp2 As Long, Tmp3 As Long
Dim BL As Boolean
For Tmp1 = 2 To n
BL = True
For Tmp2 = 2 To Tmp1
If Tmp1 Mod Tmp2 = 0 And n Mod Tmp2 = 0 Then
BL = False
Exit For
End If
Next
If BL Then
Tmp3 = Tmp3 + 1
S(Tmp3) = Tmp1
End If
Next
'输出
For Tmp1 = 1 To Tmp3
Print S(Tmp1),
If Tmp1 Mod 5 = 0 Then Print
Next
End Function