程序代码如下:
Private Sub Command1_Click()
Dim n As Integer, i As Integer
List1.Clear
n = Val(Text1.Text)
If n Mod 2 = 0 Then
For i = 2 To Int(n / 2)
If isodd(i) = (isodd(n - i)) Then
List1.AddItem Str(n) + " =" + Str(i) + " +" + Str(n - i)
End If
Next i
Else
Text1.Text = Str(n) + "不是偶数!"
End If
End Sub
Private Function isodd(n As Integer) as boolean
Dim f As integer
f = 0
For i = 2 To Sqr(n)
If n Mod i = 0 Then f = 1: Exit For
Next i
isodd = f
End Function