Solution:
Let "x" be the cost of 1 pineapple
Let "y" be the cost of 1 melon
3 pineapples and 2 melons for $34
Therefore,
3x + 2y = 34 -------- eqn 1
my friend buys 2 pineapples and 4 melons for $36
Therefore,
2x + 4y = 36 --- eqn 2
Let us solve eqn 1 and eqn 2
Multiply eqn 1 by -2
-6x -4y = -68 -------- eqn 3
Add eqn 2 and eqn 3
2x + 4y = 36
-6x -4y = -68
( + ) -------------
-4x = -32
Substitute x = 8 in eqn 1
3(8) + 2y = 34
2y = 34 - 24
2y = 10
Thus cost of 1 pineapple is $ 8 and cost of 1 melon is $ 5