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

  1. Formulate and solve the following line exactly using inputs x and y: result = x + y * 2 - 4 / 2
  2. Return the final numeric output.

01EXAMPLE 1

Inputx = 10, y = 5
Output18

Explanation: 10 + (5 * 2) - (4 / 2) = 18

Constraints

  • Solve the expression exactly: x + y * 2 - 4 / 2.
  • Return the result as a number.
FundamentalsMathPrecedence
JavaScript
Loading...
5 Hidden

Input Arguments

x10
y5

Expected Output

18

Click RUN to test your solution