...

/

Solution Review: Arithmetic Operators

Solution Review: Arithmetic Operators

In this review: we give a detailed analysis of the solution to this exercise.

Solution #1: Operator Precedence

Press + to interact
R
ans <- 4 * 9
ans <- ans + 2
ans <- ans - 8
cat(ans)

Explanation

The given task here was to find the value of the equation

2 + 4 * 9 - 8

Mathematically, we need to find the value of the multiplying numbers first, keeping in mind operator precedence. So, we multiply 44 ...