Respuesta :
A; you have to add the grades to have the total and then divide by 3 because there are 3 variables.
Answer:
Option B (grade1 + grade2 + grade3) / 3.0
Explanation:
The most accurate result is calculated by the expression given in the option B. This is because all the grade1, grade2 and grade3 variables are integer type and therefore we need to add a decimal point after divisor (e.g. 3.0) so that the decimal points of the result can be preserved.
For example:
(88 + 92 + 83) / 3.0 should result in 87.66666666666667
If we do (88 + 92 + 83) / 3, the decimal points are truncated to 87.
The expression in option c, (double)((grade1 + grade2 + grade3) / 3), will result in 87 as the (grade1 + grade2 + grade3) / 3 will be evaluated first prior to converting into double type.
The expression in option d and e are inaccurate as they don't calculate average of the three variables.