Complete the code to correctly calculate the result of 3 + 4 * 2.
let result = 3 + 4 [1] 2; println!("{}", result);
The multiplication operator * has higher precedence than addition, so 4 * 2 is calculated first, then added to 3.
Complete the code to correctly calculate the result of (3 + 4) * 2.
let result = (3 + 4) [1] 2; println!("{}", result);
The parentheses force addition first, then multiplication by 2.
Fix the error in the expression to correctly compute 10 - 3 * 2 + 1.
let result = 10 [1] 3 * 2 + 1; println!("{}", result);
The subtraction operator - must be used to get the correct calculation: 10 minus (3 times 2) plus 1.
Fill both blanks to correctly calculate the expression: 8 + 6 / 3 - 2.
let result = 8 [1] 6 [2] 3 - 2; println!("{}", result);
Division has higher precedence than addition and subtraction, so 6 / 3 is calculated first. Then 8 + (6 / 3) - 2.
Fill all three blanks to correctly compute the expression: 5 + 4 * 3 - 6 / 2.
let result = 5 [1] 4 [2] 3 [3] 6 / 2; println!("{}", result);
Multiplication and division have higher precedence than addition and subtraction. So 4 * 3 and 6 / 2 are done first, then addition and subtraction in order.