I fixed my program and got the same answer as the others before me had gotten. I used VB.NET to solve it. Here's my code:
Public
Class Form1Inherits System.Windows.Forms.Form
Private
Nines() As StringPrivate Tens() As String
Private Elevens() As String
Private NinesList As New ArrayList
Private TensList As New ArrayList
Private ElevensList As New ArrayList
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.FillArrayLists()
lblSource.Text = Me.FindAnswer()
End Sub
Private Sub FillArrayLists()
Dim aString As String
Dim sString As String
sString = txtNines.Text
Nines = sString.Split(", ")
For Each aString In Nines
NinesList.Add(Convert.ToDecimal(aString))
Next
sString = txtTens.Text
Tens = sString.Split(", ")
For Each aString In Tens
TensList.Add(Convert.ToDecimal(aString))
Next
sString = txtElevens.Text
Elevens = sString.Split(", ")
For Each aString In Elevens
ElevensList.Add(Convert.ToDecimal(aString))
Next
End Sub
Private Function FindAnswer() As String
Dim i1 As Decimal
Dim i2 As Decimal
Dim Half As Decimal
For Each i1 In NinesList
For Each i2 In NinesList
If i2 > i1 Then
If NinesList.Contains(i1 + i2) And _
NinesList.Contains(i2 - i1) And _
(NinesList.Contains(i1 / 2) Or _
NinesList.Contains(i2 / 2) Or _
NinesList.Contains((i1 + i2) / 2) Or _
NinesList.Contains((i2 - i1) / 2)) Then
If NinesList.Contains(i1 / 2) Then
Half = i1 / 2
ElseIf NinesList.Contains(i2 / 2) Then
Half = i2 / 2
ElseIf NinesList.Contains((i1 + i2) / 2) Then
Half = (i1 + i2) / 2
ElseIf NinesList.Contains((i2 - i1) / 2) Then
Half = (i2 - i1) / 2
End If
Me.DisplayResults(i1, i2, i1 + i2, i2 - i1, Half)
Return "Nines List"
Exit Function
End If
End If
Next i2
Next i1
For Each i1 In TensList
For Each i2 In TensList
If i2 > i1 Then
If TensList.Contains(i1 + i2) And _
TensList.Contains(i2 - i1) And _
(TensList.Contains(i1 / 2) Or _
TensList.Contains(i2 / 2) Or _
TensList.Contains((i1 + i2) / 2) Or _
TensList.Contains((i2 - i1) / 2)) Then
If TensList.Contains(i1 / 2) Then
Half = i1 / 2
ElseIf TensList.Contains(i2 / 2) Then
Half = i2 / 2
ElseIf TensList.Contains((i1 + i2) / 2) Then
Half = (i1 + i2) / 2
ElseIf TensList.Contains((i2 = i1) / 2) Then
Half = (i2 - i1) / 2
End If
Me.DisplayResults(i1, i2, i1 + i2, i2 - i1, Half)
Return "Tens List"
Exit Function
End If
End If
Next i2
Next i1
For Each i1 In ElevensList
For Each i2 In ElevensList
If i2 > i1 Then
If ElevensList.Contains(i1 + i2) And _
ElevensList.Contains(i2 - i1) And _
(ElevensList.Contains(i1 / 2) Or _
ElevensList.Contains(i2 / 2) Or _
ElevensList.Contains((i1 + i2) / 2) Or _
ElevensList.Contains((i2 - i1) / 2)) Then
If ElevensList.Contains(i1 / 2) Then
Half = i1 / 2
ElseIf ElevensList.Contains(i2 / 2) Then
Half = i2 / 2
ElseIf ElevensList.Contains((i1 + i2) / 2) Then
Half = (i1 + i2) / 2
ElseIf ElevensList.Contains((i2 - i1) / 2) Then
Half = Half = (i2 - i1) / 2
End If
Me.DisplayResults(i1, i2, i1 + i2, i2 - i1, Half)
Return "Elevens List"
Exit Function
End If
End If
Next i2
Next i1
Return "Null"
End Function
Private Sub DisplayResults(ByVal Num1 As Integer, ByVal Num2 As Integer, ByVal Sum As Integer, ByVal Diff As Integer, ByVal Half As Integer)
lblNum1.Text = Num1.ToString
lblNum2.Text = Num2.ToString
lblSum.Text = Sum.ToString
lblDiff.Text = Diff.ToString
lblHalf.Text = Half.ToString
End Sub
End Class