Stack 131023084444 Phpapp01

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Mahesh Kodituwakku

(A=3,B=4,C=5)
(A+B)*C
First step let's solve the brackets
(A+B)*C
(AB+)*C
Then we need to slove Mutipication
AB+*C
AB+C*
If A=3,B=4,C=5 then we have to write above
equitation as 34+5*



Step 1 is
Push(3) and Push (4)

3
4
Step 2 is
Pop(4) and Pop (3)and use expression +

3
4
Expression +
4 3
+
3+4=7
Step 3 is
Push(7) (Answer of 3+4=7)

7
Step 4 is
Then pop(5)to the stack

7
5
Step 5 is
Pop(5) and Pop (7)and use expression *

7
5
Expression *
5 7
*
7*5=35
Step 6 is
Push(35) to the stack

35
Answer is 35

You might also like