• Raghavendra Mudugal (2/6/2013)


    so, if no brackets then just start from L to R no matter what the operator is... and in the above given equation we don't know where to place the brackets and it leads to follow traditional BODMAS (excluding the BO in the sequence)... correct ?

    Let's take our today's OoTD

    Statement A:

    SELECT (45 * (9 - 5 + 8)- 36 / 4)

    Brackets first. If we have nested brackets ,then inner most first.. So first we take

    (9 - 5 + 8)

    Addition and subtraction have same precedence. In that case go from Left to Right.

    (9 - 5 + 8) => (4+8)

    (4+8) =>12

    so the exprresion will look like "SELECT (45 * 12- 36 / 4) "

    Division and Multiplication has higher precedence over Addition and subtraction. So first Multiplication and divsion has to be done before + or -.

    45*12 =>540

    36/4 =>9

    Now the expression will be "SELECT (540- 9) "

    so final result is 531

    --
    Dineshbabu
    Desire to learn new things..