Answer :

Equations:
n + d = 21
5n + 10d = 170 cents
----------------------------
Multiply thru the 1st equation by 5:
5n + 5d = 5*21
5n +10d = 170
--------------

Subtract and solve for "d":
5d = 65
d = 13 (# of dimes)
----
n+d = 21
n + 13 = 21
n = 8 (# of nickels)