let’s call the amount of pants x and the amount of shirts y.
12y + 21x = 240
y + x = 14 which could be changed to x= 14-y
now you plug it into the first equation
12y + 21 (14 - y) = 240
12y + 294 - 21y = 240
add the similar terms
12y - 21y = 240 - 294
-9y = -54
cancels the minus signs on both sides
9y = 54
y= 6
now you plug y = 6 into the equation x = 14-y
x = 14 - 6
x = 8
answer: Pam bought 8 pants and 6 shirts