Dan had $ 3 left with him after he bought a candy bar. If he had $ 4 at the start how much did the candy bar cost?
Dan had $3 left with him after he bought a candy bar. 

That means that he had to spend some money on the candy bar. 

We know that he started with $4, so that means that he spent $1 on the candy bar.