Math Hierarchy
EasyAcc. 88.4%
+25 XP 10
Order in Accounting
Standard math equations in JavaScript always follow proper priority rules (BODMAS). This means multiplication and division will occur before addition and subtraction unless brackets are added.
The Assignment
- Formulate and solve the following line exactly using inputs
xandy: result = x + y * 2 - 4 / 2 - Return the final numeric output.
01EXAMPLE 1
Input
x = 10, y = 5Output
18Explanation: 10 + (5 * 2) - (4 / 2) = 18
Constraints
- Solve the expression exactly: x + y * 2 - 4 / 2.
- Return the result as a number.
FundamentalsMathPrecedence
JavaScriptSystem handles I/O — write your function only
Loading...
5 Hidden
Input Arguments
x10
y5
Expected Output
18
Click RUN to test your solution