满意答案
xsghn
2013.11.20
采纳率:53% 等级:12
已帮助:5480人
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim SH As Integer
For i = 11 To 99 Step 2
SH = SuShu(i)
If SH = 1 Then
SH = 0
j = Val(Right(i, 1) & Left(i, 1))
SH = SuShu(j)
If SH = 1 Then
Print i
End If
End If
Next
End Sub
Private Function SuShu(i As Integer) As Integer
If i = 2 Or i = 3 Then
SuShu = 1
Exit Function
End If
If i Mod 2 = 0 Then
SuShu = 0
Exit Function
End If
Dim m As Integer
Dim j As Integer
m = Int(Sqr(i))
For j = 3 To m Step 2
If i Mod j = 0 Then
SuShu = 0
Exit Function
End If
Next
SuShu = 1
End Function
10分享举报