Week 3 : Binary Addition and Subtraction

In this week you will:

  1. Learn conversion between BIN, OCT, DEC and HEX (during the class).
  2. Learn binary addition and subtraction.
  3. Do some exercise (homework).

Rules of Binary Addition

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0, and carry 1 to the next more significant bit

For example,

00011010 + 00001100 = 00100110         1  1 carries
  0  0  0  1  1  0  1  0    = 26(base 10)
+ 0  0  0  0  1  1  0  0


   = 12(base 10)
  0  0  1  0  0  1  1  0    = 38(base 10)
00010011 + 00111110 = 01010001      1  1  1  1  1 carries
  0  0  0  1  0  0  1  1    = 19(base 10)
+ 0  0  1  1  1  1  1  0


   = 62(base 10)
  0  1  0  1  0  0  0  1    = 81(base 10)

Rules of Binary Subtraction

  • 0 - 0 = 0
  • 0 - 1 = 1, and borrow 1 from the next more significant bit
  • 1 - 0 = 1
  • 1 - 1 = 0

For example,

00100101 - 00010001 = 00010100         0 borrows
  0  0  1 10  0  1  0  1    = 37(base 10)
- 0  0  0  1  0  0  0  1


   = 17(base 10)
  0  0  0  1  0  1  0  0    = 20(base 10)
00110011 - 00010110 = 00011101         0 10  1 borrows
  0  0  1  1  0 10  1  1    = 51(base 10)
- 0  0  0  1  0  1  1  0


   = 22(base 10)
  0  0  0  1  1  1  0  1    = 29(base 10)

Exercise:

  1. Convert 10100011 from binary to decimal.
  2. Convert 101101 from binary to decimal.
  3. Convert 110100101010 from binary to decimal.
  4. Convert 11101111 from binary to octal.
  5. Convert 01000010 from binary to octal.
  6. Convert 10100011 from binary to hexadecimal.
  7. Convert 101101 from binary to hexadecimal.
  8. Convert 1FA hexadecimal to decimal.
  9. Convert C1 hexadecimal to decimal.
  10. Convert 17D hexadecimal to binary
  11. Convert 17D hexadecimal to octal.
  12. Convert 23 octal to binary.
  13. Convert 23 octal to hexadecimal.
  14. Convert 199 decimal to binary.
  15. Convert 78 decimal to hexadecimal.
  16. Convert 511 decimal to octal.
  17. Add 1101001 to 101011 in binary.
  18. Subtract 101001 from 11110111 in binary.
  19. Add 15F to C1 in hexadecimal.
  20. Add 22 to 77 in octal.

 

Leave a Reply

Your email address will not be published. Required fields are marked *