From 6 numbers and a target number, manage them with the operations (+ - * /)(using each once) to reach the target number. At the end, cause the algorithm to show which operations were used. (Remember that it is not REQUIRED to use all 6 numbers).
Example 1: 4,7,21,3,2,8. Target 112.
SHOW: 4+3 = 7 x 2 = 14 x 8 = 112
Example 2: 30,14,7,8,10,2. Target 28.
SHOW: 2 x 10 = 20 + 8 = 28
Please, anyone can help me with that???
Thank you a lot!
look for the mathematical solution before you try to write the program, when you've done it, coding will be a piece of cake.
hint:
the first thing i'll try to do is check wether the target is devidable by on of the numbers, if so i'll start with multiplication to reach the closest point to target, then i'd start applying other operations until i reach target.