Ask Question
17 May, 04:58

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. 17 May, 05:23
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers