Calculate 24 is a game in which players should find a way to calculate 24 with 4 given numbers, using only addition, subtraction, multiplication and division.
This program takes 4 numbers as input and prints out all the possible ways to get 24. For example:
~ cal24 10 7 2 3
01. (10 x 7 + 2) / 3
02. 10 x 2 + 7 - 3
03. 10 x 2 - 3 + 7
04. 10 x 2 - (3 - 7)
05. 7 + 10 x 2 - 3
06. (7 x 10 + 2) / 3
07. 7 + 2 x 10 - 3
08. 7 - 3 + 10 x 2
09. 7 - (3 - 10 x 2)
10. 7 - 3 + 2 x 10
11. 7 - (3 - 2 x 10)
12. 2 x 10 + 7 - 3
13. (2 + 10 x 7) / 3
14. 2 x 10 - 3 + 7
15. 2 x 10 - (3 - 7)
16. (2 + 7 x 10) / 3