One hat and two shirts cost $21. Two hats and one shirt cost $18.

Sam has exactly enough money to buy one hat and one shirt. How
much money does Sam have?

To solve this problem, let's assign variables to the unknown quantities.

Let's say the cost of a hat is H dollars, and the cost of a shirt is S dollars.

From the given information, we can set up two equations:
1. H + 2S = 21 (equation 1)
2. 2H + S = 18 (equation 2)

We need to solve these equations to find the values of H and S. To do this, we can use a method called elimination.

Let's multiply equation 1 by 2:
2H + 4S = 42 (equation 3)

Now, let's subtract equation 2 from equation 3 to eliminate H:
(2H + 4S) - (2H + S) = 42 - 18

Simplifying the equation gives us:
3S = 24

Dividing both sides of the equation by 3, we find:
S = 8

Now that we know the cost of a shirt, we can substitute this value into either equation 1 or equation 2 to find the value of H. Let's use equation 2:

2H + 8 = 18

Subtracting 8 from both sides of the equation gives us:
2H = 10

Dividing both sides of the equation by 2, we find:
H = 5

So, the cost of a hat is $5 and the cost of a shirt is $8.

Finally, since Sam has exactly enough money to buy one hat and one shirt, Sam has:
H + S = $5 + $8 = $13

Therefore, Sam has $13.

If the price of hat and shirt be h&s

H+2s=21
2h+s=18

Solve for h&s

Sam has a total sum of =$h+$s