Let d be number of dimes and q be number of quarters.
d + q = 21
10d + 25q = 405
Multiply the first equation by 10 and subtract from the second equation:
15q = 195. Hence q = 13
Using this in the first equation we have:
d + 13 = 21. Hence d = 8
13 quarters and 8 dimes.