代码如下:
Dim n%,n1%,n2%
n=Val(InputBox("输入大于6的正整数"))
For n1=3 to n\2 step 2
n2=n-n1
If prime(n1) Then
If prime(n2) then
Print n & "=" & n1 & "+" & n2
Exit For '结束循环
End if
End if
Next n1
Private Function Prime( m as Integer) As Boolean
Dim i%
Prime=True
For i=2 To int(sqr(m))
If m Mod i = 0 Then Prime=False: Exit For
Next i
End Function
|