The sum: 4.000000
The expression is
sum = a/b
The integer division a/b
is performed first, because /
has
higher precedence than =
.
Then, integer 4 is then coverted to double
so it can be assigned to the variable.
The type of the variable does not affect the division. (This may not be obvious. Sometimes students think the type of the variable that is assigned to affects all operations in an expression.)