In this case, we'll have to carry out several steps to find the solution.
Step 01:
Data
300 dollars = 5100 pesos
340 pesos = sweater cost (pesos)
x = sweater cost (dollars)
Step 02:
300 dollars ---------------------- 5100 pesos
x ---------------------- 340 pesos
x * 5100 = 300 * 340

The answer is :
The sweater cost $ 20.