For signed binary number left most bit represent the signed bit and the rest of the bits represent the number.
For Unsigned binary number left most bit is the most significant bit of the number.
Number | Sign | Binary number |
---|---|---|
+7 | 0 | 111 |
-7 | 1 | 111 |
Decimal | BCD Code | 2421 Code |
---|---|---|
0 | 0000 | 0000 |
1 | 0001 | 0001 |
2 | 0010 | 0010 |
3 | 0011 | 0011 |
4 | 0100 | 0100 |
5 | 0101 | 1011 |
6 | 0110 | 1100 |
7 | 0111 | 1101 |
8 | 1000 | 1110 |
9 | 1001 | 1111 |
Binary Add | Binary Sub |
---|---|
0 + 0 = 0 | 0 - 0 = 0 |
0 + 1 = 1 | 0 - 1 = 1 (borrow) |
1 + 0 = 1 | 1 - 0 = 1 |
1 + 1 = 10 (carry) | 1 - 1 = 0 |
Decimal | Gray Code | Decimal | Gray Code |
---|---|---|---|
0 | 0000 | 8 | 1100 |
1 | 0001 | 9 | 1101 |
2 | 0011 | 10 | 1111 |
3 | 0010 | 11 | 1110 |
4 | 0110 | 12 | 1010 |
5 | 0111 | 13 | 1011 |
6 | 0101 | 14 | 1001 |
7 | 0100 | 15 | 1000 |