Ask Question
28 March, 11:57

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};

+1
Answers (1)
  1. 28 March, 15:40
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers