Base 2
01101101 10010110
+
00001111 00100011
Base 16
ABCD 1234
+ -
1234 ABC
Binary addition is similar to normal addition except that two is written as 10 in binary after addition.
After summing 1 + 1 in binary, we get 2 but we represent it like 10 by a digit 0 and a carry of 1.
1)
01101101
+
00001111
--------------------
01111100
--------------------
The above sum is carried out by following steps[from right] -
1+1 = 0 with a carry of 1
1+0+1=0 with a carry of 1
1+1+1 =1 with a carry of 1
1+1+1 =1 with a carry of 1
1+0+0 = 1
1+0=1
1+0=1
0+0=0
Hence result of addition = 01111100
2)
10010110
+
00100011
--------------------
10111001
--------------------
The above sum is carried out by following steps[from right] -
0+1 = 1
1+1=0 with a carry of 1
1+1+0 =0 with a carry of 1
1+0+0 =1
1+0 = 1
0+1=1
0+0=0
1+0=1
Hence result of addition = 10111001
Subtraction in binary/base2
10010110
-
00100011
--------------------
01110011
--------------------
We can do subtraction in base 2 using complement Method as shown below
step 1 - Represent both the numbers in same number of digits . Here both 10010110 and 00100011 have 8 digits .but if any one number had say 7 digits [0100011] then we add zeros in the start i.e. 00100011
step 2 - change all 0s to 1s and 1s to 0s in second term . Here first term- 10010110 and Second term -00100011
So we change 00100011 to 11011100 . And add 1 to the newly obtained term 11011100+1 =11011101
step 3 - We add newly obtained term with first term
11011101
+
10010110
--------------------
101110011
--------------------
step 4 - Discard the first digit , so after discarding first digit i.e. 1 , we have 01110011
Hence result of addition = 01110011
3)
Decimal to Hex converison table -
Decimal
base 10 |
Hex
base 16 |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
5 | 5 |
6 | 6 |
7 | 7 |
8 | 8 |
9 | 9 |
10 | A |
11 | B |
12 | C |
13 | D |
14 | E |
15 | F |
16 | 10 |
17 | 11 |
18 | 12 |
19 | 13 |
20 | 14 |
21 | 15 |
22 | 16 |
23 | 17 |
24 | 18 |
25 | 19 |
26 | 1A |
27 | 1B |
28 | 1C |
29 | 1D |
30 | 1E |
40 | 28 |
50 | 32 |
60 | 3C |
70 | 46 |
80 | 50 |
90 | 5A |
100 | 64 |
200 | C8 |
1000 | 3E8 |
2000 | 7D0 |
ABCD
+
1234
-------------
BE01
-------------
Explanation:
1. D+4= 13(as per hex conversion table above) +4 = 17
Now 17 is not less than 16 , so we subtract 17-16 = 1 . And we add a carry of 1 to the left .
Note : if it was less than 16 then we dont do above operation of subtracting 16 and then adding a carry of 1 to left.
2. C+3+1(carry) = 12+3+1 = 16
So we subtract 16-16 = 0. And we add a carry of 1 to the left .
3. B+2 +1(carry) = 11+3=14 = E(as per hex table above).
4. A+1 = 10 +1 = 11 = B(as per hex table above)
Hence result of addition = BE01
4)
Hexadecimal Subtraction:
1234
-
ABC
-------------
778
-------------
In the decimal system, you borrow 10, but in hexadecimal system you borrow 16.
i. 4-C = 4-12(as per hex table) = -8 ,since result is negative we borrow 16 from 3 .
so 4-12+16=8
ii. 3-B-1(borrow) = 3-11-1 = -9 ,since result is negative we borrow 16 from 2 .
so 3-11-1+16 = 7
iii. 2-A-1(borrow) = 2-10-1 =-9 , since result is negative we borrow 16 from 1 .
so 2-10-1+16 = 7
iv. 1-1(borrow) = 0
Hence result of subtraction = 778
Get Answers For Free
Most questions answered within 1 hours.