in Programming in C
470 views
0 votes
0 votes

I want to know which evaluation is wrong here:

  1. a-b-c = ab-c-

      or a-b-c  = abc- –

  1. a * b *c = ab*c*

          a*b*c  =  abc**

     3 .    a+b-c = ab+c-

            a+b-c = abc-+

in Programming in C
470 views

5 Comments

edited by
Each question’s 1st  statement is correct and the 2nd one is wrong.
0
0

See this question and try to solve.

0
0
Ans is option D

1. (--ABC) + D/E * (+FG)

2. (--ABC) + /DE * (+FG)

3. (--ABC) + */DE+FG

4. +--ABC*/DE+FG
0
0
When two operators have same preference, then associativity indecates which needs to evaluate further.

Your first statements are based upon left associativity, where second ones are based upon right associativities.

 

So first fix the associativity of operators, then try to convert into postfix/prefix
1
1
thank you
0
0

Please log in or register to answer this question.