Let x represent the number of T shirts that they sold
Let y represent the number of hats that they sold
They sold the T-shirts for $12 and the Hats for $5. This means that the cost of x T shirts and y hats would be
12 * x + 5 * y
= 12x + 5y
The total amount raised was $265. It means that
12x + 5y = 265 equation 1
Also, the total number of t shirts and hats sold was 32. It means that
x + y = 32
x = 32 - y
Substituting x = 32 - y into equation 1, it becomes
12(32 - y) + 5y = 265
384 - 12y + 5y = 265
- 12y + 5y = 265 - 384
7y = 119
y = 119/7
y = 17
x = 32 - y = 32 - 17
x = 15
15 T shirts and 17 hats