1.

you are given an arithmetic expression which contains only (+ - * /) operators. precision of (* /) is greater than precision of(+ -). you have to evaluate the expression if 2 consecutive same priority operator occur evaluate them from left to right.

Answer»

No two signs have the same priority.

The order of precision follows the BODMAS RULE acc to which,

Bracket > Of > Division > Multiplication > Addition > Subtraction.

Now as per your QUERY to EVALUATE the expression if 2 consecutive same priority operator occur, then they can be simplified togetherly.

eg: 4 X 12 / 6 + 2 - 3 - 1

or, 4 x 2 + 2 - 3 - 1

or, 8 + 2 - 3 - 1

or, 10 - 3 - 1

or, 6 (Ans)

if your objective is SOMETHING different from this then please let us know. Better to mention the question example.



Discussion

No Comment Found

Related InterviewSolutions