Let $d$ denote the number of dimes ($10¢$) and $q$ denote the number of quarters ($25¢$).
In cents, 10 dollars equals $1,000¢$:
$$10d + 25q = 1000$$
Dividing the entire equation by $5$:
$$2d + 5q = 200$$
We can solve for $2d$:
$$2d = 200 - 5q = 5(40 - q)$$
Now consider the arithmetic constraints:
The problem specifies that at least one of each coin must be used, so $d \ge 1$ and $q \ge 1$.
Because $d \ge 1$, the left-hand side $2d$ is a positive even integer.
Therefore, the right-hand side $5(40 - q)$ must also be a positive even integer:
For $5(40 - q) > 0$, we must have $40 - q > 0 \implies q < 40$.
For $5(40 - q)$ to be even, $40 - q$ must be even, which means $q$ itself must be an even integer!
Since $q \ge 1$ and $q$ is even with $q < 40$, the allowable values for $q$ are:
$$q \in \{2, 4, 6, 8, \dots, 36, 38\}$$
Writing $q = 2k$, we have $1 \le k \le 19$.
There are exactly 19 possible values for $q$, each giving a unique positive integer $d = 100 - 5k$.
In this lesson, we write a program to search for all valid combinations of dimes and quarters, print the complete ledger of solutions, and verify the total count!
ways = 0 for q = 1, 39 do rem = 1000 - 25 * q if rem > 0 and rem % 10 == 0 then d = rem / 10 ways = ways + 1 end end
Move the mouse over a dotted box for more information.
The program finds that there are exactly 19 ways to make change for \$10 using at least one dime and at least one quarter.
The solutions range from $2$ quarters and $95$ dimes to $38$ quarters and $5$ dimes.
Now you try. Run the code to see all 19 solutions. Then check Example 1 to see how many solutions exist if having zero dimes or zero quarters is allowed!
Type your code here:
See your results here:
Hit Run to generate all 19 combinations of dimes and quarters!
Observe that every valid number of quarters is an even number ($2, 4, 6, \dots, 38$).
Why? Because an odd number of quarters produces an odd multiple of $5$ (ending in $5$), leaving a remainder that cannot be made with $10¢$ dimes!
Check out the examples below to explore what happens when zero coins are permitted, or when nickels are added!
Share your code
Show a friend, family member, or teacher what you've done!