Problem 44545. "Percentages may not total 100 due to rounding"

Percentages are commonly rounded when presented in tables. As a result, the sum of the individual numbers does not always add up to 100%. A warning is therefore sometimes appended to such tables, along the lines: "Percentages may not total 100 due to rounding".

EXAMPLE 1: A survey of eleven people for their opinion on a new policy found five to be in favour, five opposed, and one undecided/neutral. Percentage-wise this becomes

In favour:          45% (5 of 11)
Undecided/neutral:   9% (1 of 11)  
Opposed:            45% (5 of 11)  

The total of these is 99%, rather than the expected 100%. Despite this conflict, in this example all of the individual numbers have been correctly entered.

EXAMPLE 2: In the same report, a survey of a further ten people on a different policy found four to be in favour, four opposed, and two undecided/neutral. Suppose the data were presented in the following table

In favour:          45%
Undecided/neutral:  20%
Opposed:            45%

Given the background information, we would quickly recognise this as inconsistent, with a spurious total of 110%, rather than the expected 100%. In fact, we would probably guess that a copy-and-paste mistake had occurred. However, it is important to realise that even if we looked at this table alone, in isolation, without any background knowledge of the survey size or the true number of responses in any category, just by knowing that there are only three categories we can firmly conclude that in this example one or more of the individual numbers must have been entered incorrectly.

YOUR JOB: Given a list (vector) of integer percentages, determine whether among the individual values at least one of them must have been incorrectly entered (return true), as in Example 2, or whether there might not be any incorrect entries (return false), as in Example 1.

Solution Stats

23.53% Correct | 76.47% Incorrect
Last Solution submitted on Nov 14, 2022

Solution Comments

Show comments

Problem Recent Solvers3

Suggested Problems

More from this Author32

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!