Cost of a pineapple will be Rs. 7 each whereas a watermelon will cost Rs. 5…

2024

Cost of a pineapple will be Rs. 7 each whereas a watermelon will cost Rs. 5 each. A man spends a total of Rs. 38 on these fruits. The number of pineapples that he purchased were:

  1. A.

    2

  2. B.

    3

  3. C.

    4

  4. D.

    Data inadequate

Attempted by 17 students.

Show answer & explanation

Correct answer: C

Explanation:

Let the number of pineapples be x and the number of watermelons be y (both nonnegative integers).

Total cost equation: 7x + 5y = 38.

  1. Rearrange to express y: y = (38 − 7x) / 5. For y to be an integer, (38 − 7x) must be divisible by 5.

  2. Work modulo 5 to find x values that make the numerator divisible by 5: 7x ≡ 38 (mod 5). Since 7 ≡ 2 (mod 5) and 38 ≡ 3 (mod 5), this gives 2x ≡ 3 (mod 5).

  3. Multiply both sides by 3 (the inverse of 2 modulo 5) to get x ≡ 4 (mod 5). So possible x values are 4, 9, 14, ... .

  4. Try the smallest nonnegative solution x = 4: y = (38 − 7×4) / 5 = (38 − 28) / 5 = 10 / 5 = 2, which is valid.

  5. The next candidate x = 9 gives y = (38 − 63) / 5 = −25 / 5 = −5, which is not allowed because counts must be nonnegative. Therefore x = 4 is the only feasible solution.

Answer: 4 pineapples.

Explore the full course: Infosys Preparation