in Others
6,249 views
2 votes
2 votes

The value of postfix expression: 834+-382/+*2$3+ is

  1. 17
  2. 131
  3. 64
  4. 52
in Others
6.2k views

2 Answers

4 votes
4 votes
Best answer
POSTFIX EVALUATION ALGO

1) push the operands  in stack when  operator X comes take top 2 values say A and B  and perform B X A and store the result at top  of stack

2)Repeat the procedure till end of expression

here push 8 3 4 now +comes 3+4=7 stack now contains 8 7 now - comes so 8-7=1 stack now has 1

push 3 8 2 now / comes perform 8/2=4 then +comes 3+4 =7 stack now has 1  7 then * comes stack now has 7*1=7

now push 2  $ (power )comes perform 7^2=49 push 3    +comes  stack now has 49 3 perform 49+3=52

hence final ans is D
selected by

4 Comments

ok thank yousmiley

0
0
@sanjay and @leen how would you know 834 is a single no or 3 different numbers..
0
0
if you consider 834 as a single number then can't apply + operation on it because + is a binary operator.
1
1
0 votes
0 votes

834+-382/+*2$3+

=87-382/+*2$3+

=1382/+*2$3+

=134+*2$3+

=17*2$3+

=72$3+

=49 3 +

=52

Hence,Option(D)52.

Answer:

Related questions