1,101 views
3 votes
3 votes
X=(M+N*O)/(P*Q)  How many zero-address instructions are there?

I did it.Just want to check whether it is right?

PUSH P

PUSH Q

MUL

PUSH N

PUSH O

MUL

PUSH M

ADD

DIV

POP X

So total 10 instructions required.Correct?

2 Answers

2 votes
2 votes
X=(M+N*O)/(P*Q)  
post order MNO*+PQ*/
PUSH M
PUSH N
PUSH O
MUL
ADD
PUSH P
PUSH Q
MUL
DIV
POP X
zero address instruction 4
one address instruction 6
0 votes
0 votes
No of instructions required will be dependent on architecture set...Say if there is no Mul instruction then we need to mul  instruction by using add instruction...so to ans que we need to know architecture or instruction set

Related questions

0 votes
0 votes
2 answers
2