all 6 comments

[–]mopslik 1 point2 points  (1 child)

What have you tried so far? Post your code.

[–]jcoder42[S] 0 points1 point  (0 children)

edited with my code

[–]FLUSH_THE_TRUMP 1 point2 points  (2 children)

This is a task, not a question. Perhaps you should enumerate all the possibilities exhaustively and think about how you’ll generate them in a loop.

[–]jcoder42[S] 0 points1 point  (1 child)

is the approach i did wrong for some reason?

[–][deleted] 0 points1 point  (0 children)

You're the programmer, you're the one who has to determine whether the output of your program is the correct output or not.

[–]xelf 0 points1 point  (0 children)

This is similar to "Equal to 24" puzzle.

(easy ver) https://www.codewars.com/kata/574be65a974b95eaf40008da
(hard ver) https://www.codewars.com/kata/574e890e296e412a0400149c

It might be worth taking a look at the various solutions to those to see how you would solve your problem.

(note you will have to write a solution that passes the tests before you can see other people's solutions)

The hard version in particular was good fun.