Cls '清空屏幕
Dim b,c,d,e As Integer
For b = 0 To 3
For c = 0 To 3
For d = 0 To 3
For e = 0 To 3
If b<>c And c<>d And d<>e And e<>b And b<>d And c<>e Then
If a(b) + a(c) + a(d) + a(e) = 24 Then ?a(b);"+";a(c);"+";a(d);"+";a(e)
If a(b) + a(c) + a(d) - a(e) = 24 Then ?a(b);"+";a(c);"+";a(d);"-";a(e)
If a(b) + a(c) - a(d) - a(e) = 24 Then ?a(b);"+";a(c);"-";a(d);"-";a(e)
If a(b) - a(c) - a(d) - a(e) = 24 Then ?a(b);"-";a(c);"-";a(d);"-";a(e)
If a(b) * a(c) + a(d) + a(e) = 24 Then ?a(b);"×";a(c);"+";a(d);"+";a(e)
If a(b) * a(c) + a(d) - a(e) = 24 Then ?a(b);"×";a(c);"+";a(d);"-";a(e)
If a(b) * a(c) - a(d) - a(e) = 24 Then ?a(b);"×";a(c);"-";a(d);"-";a(e)
If a(b) * a(c) * a(d) + a(e) = 24 Then ?a(b);"×";a(c);"×";a(d);"+";a(e)
If a(b) * a(c) * a(d) - a(e) = 24 Then ?a(b);"×";a(c);"×";a(d);"-";a(e)
If a(b) * a(c) * a(d) * a(e) = 24 Then ?a(b);"×";a(c);"×";a(d);"×";a(e)
If a(b) / a(c) + a(d) + a(e) = 24 Then ?a(b);"÷";a(c);"+";a(d);"+";a(e)
If a(b) / a(c) + a(d) - a(e) = 24 Then ?a(b);"÷";a(c);"+";a(d);"-";a(e)
If a(b) / a(c) * a(d) + a(e) = 24 Then ?a(b);"÷";a(c);"×";a(d);"+";a(e)
If a(b) / a(c) * a(d) - a(e) = 24 Then ?a(b);"÷";a(c);"×";a(d);"-";a(e)
If a(b) / a(c) / a(d) + a(e) = 24 Then ?a(b);"÷";a(c);"÷";a(d);"+";a(e)
If a(b) / a(c) / a(d) - a(e) = 24 Then ?a(b);"÷";a(c);"÷";a(d);"-";a(e)
If a(b) / a(c) / a(d) * a(e) = 24 Then ?a(b);"÷";a(c);"÷";a(d);"×";a(e)
If a(b) / a(c) / a(d) / a(e) = 24 Then ?a(b);"÷";a(c);"÷";a(d);"÷";a(e)
If a(b) / a(c) + a(d) * a(e) = 24 Then ?a(b);"÷";a(c);"+";a(d);"×";a(e)
If a(b) / a(c) - a(d) * a(e) = 24 Then ?a(b);"÷";a(c);"-";a(d);"×";a(e)
If a(b) / a(c) + a(d) / a(e) = 24 Then ?a(b);"÷";a(c);"+";a(d);"÷";a(e)
If a(b) / a(c) - a(d) / a(e) = 24 Then ?a(b);"÷";a(c);"-";a(d);"÷";a(e)
End If
Next e,d,c,b
可能有問題,請先試試,有問題問我