2 2 OP_ADD 3 3 op_mul OP_ADD
You added 2 + 2 instead of multiplying them
My result is:
- 2 2 OP_MUL 3 3 OP_MUL OP_ADD
2 2 OP_MUL 3 3 OP_MUL OP_ADD
2 x 2 + 3 x 3 = 13 in stack
2 2 op_mul 3 3 op_mul op_add
2 2 OP_MUL 3 3 OP_MUL OP_ADD
2 2 OP_MUL
3 3 OP_MUL
OP_ADD
this is how i did it and it worked (i used 3 lines of code) β¦ then I checked if it can be done in one line and it actually works the same way
2 2 OP_MUL 3 3 OP_MUL OP_ADD
Assignment Answer:
2 2 OP_MUL 3 3 OP_MUL OP_ADD
I did 2 2 OP_MUL 3 3 OP_MUL OP_ADD on the first try, returned 0xD which I assume is 13
0xD its 10? D=10??? -------------------------
Maybe you want to learn about the hexadecimals to understand why 0xD is 13.
https://www.mathsisfun.com/hexadecimals.html
Carlos Z
2 2 OPP_MUL 3 3 OP_MUL OP_Add
**1.) in order to get 0xD:
2 2 op_mul
3 3 op_mul
op_add
2 2 op_mul 3 3 OP_MUL OP_ADD
You could remove the OP_NOP commands, they are basically just null operations that donβt do anything but make the code messy
2 2 op_mul 3 3 op_mul op_add
this outputs 0xd (13)
would it be better practice to use:
3 3 op_mul 2 2 op_mul op_add
As the β9β would be βaβ and the β4β would be βbβ