Script - Bitcoin Programming Discussion

2 2 OP_ADD 3 3 op_mul OP_ADD

You added 2 + 2 instead of multiplying them :slight_smile:

2 Likes

My result is:

  • 2 2 OP_MUL 3 3 OP_MUL OP_ADD
1 Like

2 2 OP_MUL 3 3 OP_MUL OP_ADD

2 x 2 + 3 x 3 = 13 in stack

1 Like

2 2 op_mul 3 3 op_mul op_add

1 Like

2 2 OP_MUL 3 3 OP_MUL OP_ADD :slight_smile:

1 Like

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

1 Like

Assignment Answer:
2 2 OP_MUL 3 3 OP_MUL OP_ADD

1 Like

I did 2 2 OP_MUL 3 3 OP_MUL OP_ADD on the first try, returned 0xD which I assume is 13

1 Like

0xD its 10? D=10??? -------------------------

Maybe you want to learn about the hexadecimals to understand why 0xD is 13. :nerd_face:

https://www.mathsisfun.com/hexadecimals.html

Carlos Z

1 Like

2 2 OPP_MUL 3 3 OP_MUL OP_Add

1 Like

**1.) in order to get 0xD:

2 2 op_mul
3 3 op_mul
op_add
1 Like

1 Like

2 2 op_mul 3 3 OP_MUL OP_ADD

1 Like

Here the little homework.

1 Like

You could remove the OP_NOP commands, they are basically just null operations that don’t do anything but make the code messy :slight_smile:

2 Likes

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

1 Like

As the β€˜9’ would be β€˜a’ and the β€˜4’ would be β€˜b’

Script Programming Assignment :keyboard:

1 Like