Hi there!
Dan spent a total of $18
He spent $2 on a soft drink and the rest he spent on candy bars
So he spent $18 - $2 on candy bars, which means he spent $16 on candy bars
He bought 8 candy bars for $16, so in order to find how much 1 candy bar costs, you need to divide the amout he spent by the total number of candy bar :
$16 รท 8 = $2
Which means that each candy bar costs $2.
There you go! I really hope this helped, if there's anything just let me know! :)