List all possible combinations of coins in a dollar

Hello all, I'm here because I can't seem to figure out how to create an algorithm that lists all possible quarter, dime, nickel and penny combinations in a dollar.

I need to print the result to the console, and have it in the following format

q|d|n| p

4000

3210

So on and so forth.

Any ideas are welcome.

[349 byte] By [icedevil6a] at [2007-10-3 6:38:25]
# 1

well, how many quarters could you have? Any number between zero and 4 inclusive, right? And how did you figure those numbers out?

Suppose you decided that there are 3 quarters in the dollar. How much does that leave to work out with the other coins?

Suppose you got so much to work out with dimes and below. How many dimes could you take out? When you take out some number of dimes how much is left?

If you have a unique choice in the number of quarters and given that choice a unique choice of number of dimes and given that ... Does that present a unique possible way of getting a dollar?

Does every possible way of getting a dollar show up on the list?

Is it clear what you have to do now?

marlin314a at 2007-7-15 1:26:58 > top of Java-index,Other Topics,Algorithms...