24-Point Game by Y. Daniel Liang

The 24-pogame is to pick any four cards from 52 cards. Note that the Jokers are excluded. Each card represents a number. An Ace, King, Queen, and Jack represent 1, 13, 12, and 11, respectively. Given four cards, use each number from the four cards once and only once to form an expression. You can use the operators (addition, subtraction, multiplication, and division) and parentheses in the expression. The expression must evaluate to 24.

The following program lets the user enter four values, each between 1 and 13. The user can then click the Solve button to display the solution or display no solutions if none exist.



The following program lets the user randomly generate four cards. The program can automatically finds a solution if one exists or reports no solution.

Lamp Lamp Lamp Lamp