As a graduate I went for an interview for a java development role and was doing pretty well in the technical examinations until i came up against this question.
If i
Let say your possible coins are x1 ...xn :
if you're asked to print all the possiblities for $2 then you could print recursively all the possibilities for :
2-x1 2-x2 .. 2-xn
Yoou will eventually get all the solutions
You can initialise this recursive process with amount-xi = 0 then print