1个回答
展开全部
Sub main()
Dim c&, d&, i&, j&, t%, m%, n%, a&(5000)
Debug.Print "..."
c = InputBox("c=")
d = InputBox("d=")
If c Mod 2 = 0 Then c = c + 1
For i = c To d Step 2
t = 0
For j = 3 To Sqr(i) Step 2
If i Mod j = 0 Then t = 1: Exit For
Next
If t = 0 Then
m = m + 1
a(m) = i
End If
Next
For i = 1 To m - 1
If a(i + 1) - a(i) = 2 Then
Debug.Print a(i); ","; a(i + 1),
n = n + 1
End If
Next
Debug.Print vbCrLf; n
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询