252 strawberries were packed into a total of 24 bags. Each bag contains either 8 strawberries or 12 strawberries. How many bags contain 8 strawberries?

Let

x = # 8-berry bags
y = # 12-berry bags
Then you know that
x+y = 24
8x+12y = 252
so, since y = 24-x,
8x + 12(24-x) = 252
Now finish it off