問題文
A reporting method computes a percentage with the single line int percent = count * 100 / total; where count holds 3 and total holds 8. Which statement describes the value that percent receives and the reason?
選択肢
- The variable receives 0, because the division binds more tightly than the multiplication, so 3 divided by 8 is evaluated as the first step
- The line fails to compile, because the whole expression is promoted to double and an explicit cast back to int is required for the assignment
- The variable receives 37, because the multiplication runs first and the division that follows works on two int values and drops the fraction of 37.5
- The variable receives 38, because an int division rounds the exact quotient of 37.5 to the nearest whole number before the assignment takes place