24 is a mental arithmetic game, first played using poker cards. Given four integers, the objective is to produce the number 24 using the standard arithmetic operators +, −, ∗ and /, while consuming all four numbers in the process.
Done in 2018
Instead of using several layers of loop, it can be done by recursive. Also this way can make the input has no length limit.