The system of equations is
Solving that system for n and d in terms of q you get:
To have a positive number of nickels, we must have at least
2 quarters. To have a positive number of dimes, we have to
have no more than 5 quarters
So if we have 2 quarters,
then we have n=3(2)-5 or 1 nickel, and d=21-4(2)=13 dimes
If we have 3 quarters,
then we have n=3(3)-5 or 4 nickels, and d=21-4(3)=9 dimes
If we have 4 quarters,
then we have n=3(4)-5 or 7 nickels, and d=21-4(4)=5 dimes
If we have 5 quarters,
then we have n=3(5)-5 or 10 nickels, and d=21-4(5)=1 dimes
So there are four solutions:
2 quarters, 13 dimes, and 1 nickle
3 quarters, 9 dimes, and 4 nickles
4 quarters, 5 dimes, and 7 nickles
5 quarters, 1 dime, and 10 nickles
Edwin