Function SolveForZ(x As Integer) As Integer Dim As Integer a, b, c, d, e, f, g, h, z For z = 0 To 20 e = x + 11 f = 11 + (x+z) g = (x+z) + 4 h = 4 + z If e + f = 40 Then c = f + g d = g + h a = 40 + c b = c + d If a + b = 151 Then Return z End If Next z Return -1 End Function Dim As Integer x = -1, z = 0 Do x = x + 1 z = SolveForZ(x) Loop Until z >= 0 Print "X ="; x Print "Y ="; x + z Print "Z ="; z Sleep