Answer:
Let the entire purchase amount be the number of bags he bought, B, times the price per bag
So B*8 = the entire purchase price
From this ...he subtracts 10 and pays 30
So we have this
B*8 - 10 = 30 add 10 to both sides
B*8 = 40 divide both sides by 8
B = 5 bags