A pineapple costs Rs 7 each and a watermelon costs Rs. 5 each. If I spend Rs 38 on total what is the number of pineapple I purchased?  Options:
A) 7  B) 6  C) 5  D) 2  E) 3

Rationale: explanation : the equation for this problem can be made as : 5 x + 7 y = 38 where x is the number of watermelons and y is the number of pineapples . now test for 2 , 3 and 4 : for y = 2 5 x + 14 = 38 x is not an integer for y = 3 5 x = 17 x not an integer for y = 4 x = 2 so 4 pineapples and 2 watermelons can be bought by 38 rs . answer : d
Answer: D