122k views
4 votes
Christina used the following expression to calculate the average ages of her three program users:

average = age1 + age2 + age3 / 3

However, her output is not correct. How can she fix this?
Add quotation marks around the age values
Put parentheses () around the age values
Substitute the number 3 with the word "three"
Use a multiplication symbol * instead of a division symbol /

1 Answer

1 vote

Final answer:

Christina should correct her average age calculation by adding parentheses around the sum of the ages to ensure proper order of operations: average = (age1 + age2 + age3) / 3.

Step-by-step explanation:

The student, Christina, can fix the incorrect output of her average age calculation by putting parentheses around the age values before dividing by 3. The corrected expression should read average = (age1 + age2 + age3) / 3. Without the parentheses, the division operation is executed before the addition due to the order of operations, which can lead to an incorrect result. When the sum of the ages is correctly enclosed in parentheses, the addition will be performed before the division, giving the correct average age of her program users.

User Maxum
by
8.4k points