Professional Documents
Culture Documents
Assignment 1
Assignment 1
ADDITION, SUBTRACTION
Hassan Danial
SP16-BCS-018
05-OCT-2017
Q 1: Convert the following numbers to hexa-decimal.
(a) 10010101101010111010101010101111b
Sol: 0 x 9 5 A B A A A F
(b) 8997897
Sol:
16 8997897
16 562368 - 9
16 35148 - 0
16 2196 - C
16 137 - 4
8-9
(0x89C09)16
0x7DD8
7 D D 8
0111 1101 1101 1000
8 2 2 8 2’s Compliment
16-bit = - 0 x 8 2 2 8
(b) 234
Sol:
16 234
E-A
0xEA
E A
1110 1010
0001 0 1 1 0 2’s Compliment
1 6 2’s Compliment
16-bit = - 0 x F F 1 6
Q 5: Do the following binary and hex subtraction by two's
compliment addition:
Sol:
(a) A 10110100b – B 10010111b
10110100
0 1 1 0 1 0 0 1 2’s Compliment of B
00011101
2’s Compliment of B
1 2 A B 8 7 9 6
0001 0010 1010 1001 1000 0111 1001 0110
1110 1101 0101 0100 0111 1000 0110 1010 2’s Compliment
E D 5 4 7 8 6 A 2’s Compliment
0xFE0F012 3
0xED54786A
0x