Dan has $ 4. He bought a candy bar for $ 8. Then his friend gave him $ 5 how much money is left?
:

1. Dan has $4.
2. He buys a candy bar for $8.
3. His friend gives him $5.

So now we need to calculate how much money Dan has in total. We can do this by starting with his original amount ($4), and then adding the value of the candy bar ($8) and his friend's gift ($5). So in total, Dan has $4 + $8 + $5 = $17.