I think the best would be if you could share your
- Solution design, where you explain how you intended to solve the problem
- what are your inputs?
- what are your outputs?
- in what format you store your data?
- what is mathematical logic to solve the problem?
- do you stop at the first possible solution or you want to detect multiple solutions?
- how do you present your solution to the user?
- Your existing code
- Maybe share the whole project for clarity
- Explain where you got stuck
- Describe any error, if you see (compilation or execution error).
Asking for a solution for such a non-straight-forward problem probably will get you nowhere. It is not likely that someone can write you the whole solution in a short amount of time. Also, this sounds like a homework assignment or that sort, so the point is to learn from it. Getting a ready-to-use solution will defeat the purpose.
For not getting an output, you should start debugging the code and try to trace what it is doing.
Provide more details and people can help you with specifics. ;)