Ask Question
23 May, 20:09

Fair division Alice and Bob inherited a collection of paintings. However, they will receive it only if the collection can be divided into two parts of exactly equal price. (Otherwise, it will be donated to a local art museum.) Is the collection divisible into two exactly equal halves? We have to find the answer. The prices of the paintings are provided as an array of integers. For example: int prices [] = {10, 15, 12, 18, 19, 17, 13, 35, 33};

+5
Answers (1)
  1. 23 May, 22:37
    0
    The way to solve this question is find the length of the array and then divide it by 2. If the modulus is 0, the number is even, and the collection is divisible. Otherwise, if the modulus is 1, the number is odd, the collection is not divisible and will be donated to a local art museum.

    Step-by-step explanation:

    The way to solve this question is find the length of the array and then divide it by 2. If the modulus is 0, the number is even, and the collection is divisible. Otherwise, if the modulus is 1, the number is odd, the collection is not divisible and will be donated to a local art museum.

    In this case:

    int prices [] = {10, 15, 12, 18, 19, 17, 13, 35, 33};

    The array has 9 elements, and 9%2 = 1, so it is not divisible into two equal parts.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Fair division Alice and Bob inherited a collection of paintings. However, they will receive it only if the collection can be divided into ...” in 📙 Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers