Question

In: Computer Science

Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030...

Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal.

a.3030

b.404

c.5050

d.-5050

e.-20000

Show work with steps

Solutions

Expert Solution

a)
Since this is a positive number. we can directly convert this into binary
Divide 3030 successively by 2 until the quotient is 0
3030/2 = 1515, remainder is 0
1515/2 = 757, remainder is 1
757/2 = 378, remainder is 1
378/2 = 189, remainder is 0
189/2 = 94, remainder is 1
94/2 = 47, remainder is 0
47/2 = 23, remainder is 1
23/2 = 11, remainder is 1
11/2 = 5, remainder is 1
5/2 = 2, remainder is 1
2/2 = 1, remainder is 0
1/2 = 0, remainder is 1
Read remainders from the bottom to top as 101111010110
Adding 4 zeros on left hand side of this number to make this of length 16
so, 3030 in 2's complement binary is 0000101111010110

Converting 0000101111010110 to hexadecimal
0000 => 0
1011 => B
1101 => D
0110 => 6
So, in hexadecimal 0000101111010110 is 0x0BD6

b)
Since this is a positive number. we can directly convert this into binary
Divide 404 successively by 2 until the quotient is 0
404/2 = 202, remainder is 0
202/2 = 101, remainder is 0
101/2 = 50, remainder is 1
50/2 = 25, remainder is 0
25/2 = 12, remainder is 1
12/2 = 6, remainder is 0
6/2 = 3, remainder is 0
3/2 = 1, remainder is 1
1/2 = 0, remainder is 1
Read remainders from the bottom to top as 110010100
Adding 7 zeros on left hand side of this number to make this of length 16
so, 404 in 2's complement binary is 0000000110010100

Converting 0000000110010100 to hexadecimal
0000 => 0
0001 => 1
1001 => 9
0100 => 4
So, in hexadecimal 0000000110010100 is 0x0194

c)
Since this is a positive number. we can directly convert this into binary
Divide 5050 successively by 2 until the quotient is 0
5050/2 = 2525, remainder is 0
2525/2 = 1262, remainder is 1
1262/2 = 631, remainder is 0
631/2 = 315, remainder is 1
315/2 = 157, remainder is 1
157/2 = 78, remainder is 1
78/2 = 39, remainder is 0
39/2 = 19, remainder is 1
19/2 = 9, remainder is 1
9/2 = 4, remainder is 1
4/2 = 2, remainder is 0
2/2 = 1, remainder is 0
1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1001110111010
Adding 3 zeros on left hand side of this number to make this of length 16
so, 5050 in 2's complement binary is 0001001110111010

Converting 0001001110111010 to hexadecimal
0001 => 1
0011 => 3
1011 => B
1010 => A
So, in hexadecimal 0001001110111010 is 0x13BA

d)
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 5050 successively by 2 until the quotient is 0
5050/2 = 2525, remainder is 0
2525/2 = 1262, remainder is 1
1262/2 = 631, remainder is 0
631/2 = 315, remainder is 1
315/2 = 157, remainder is 1
157/2 = 78, remainder is 1
78/2 = 39, remainder is 0
39/2 = 19, remainder is 1
19/2 = 9, remainder is 1
9/2 = 4, remainder is 1
4/2 = 2, remainder is 0
2/2 = 1, remainder is 0
1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1001110111010
Adding 3 zeros on left hand side of this number to make this of length 16
So, 5050 in normal binary is 0001001110111010
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   0001001110111010 is flipped to 1110110001000101
Step 3:. Add 1 to above result
1110110001000101 + 1 = 1110110001000110
so, -5050 in 2's complement binary is 1110110001000110

Converting 1110110001000110 to hexadecimal
1110 => E
1100 => C
0100 => 4
0110 => 6
So, in hexadecimal 1110110001000110 is 0xEC46

e)
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 20000 successively by 2 until the quotient is 0
20000/2 = 10000, remainder is 0
10000/2 = 5000, remainder is 0
5000/2 = 2500, remainder is 0
2500/2 = 1250, remainder is 0
1250/2 = 625, remainder is 0
625/2 = 312, remainder is 1
312/2 = 156, remainder is 0
156/2 = 78, remainder is 0
78/2 = 39, remainder is 0
39/2 = 19, remainder is 1
19/2 = 9, remainder is 1
9/2 = 4, remainder is 1
4/2 = 2, remainder is 0
2/2 = 1, remainder is 0
1/2 = 0, remainder is 1
Read remainders from the bottom to top as 100111000100000
Adding 1 zeros on left hand side of this number to make this of length 16
So, 20000 in normal binary is 0100111000100000
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   0100111000100000 is flipped to 1011000111011111
Step 3:. Add 1 to above result
1011000111011111 + 1 = 1011000111100000
so, -20000 in 2's complement binary is 1011000111100000

Converting 1011000111100000 to hexadecimal
1011 => B
0001 => 1
1110 => E
0000 => 0
So, in hexadecimal 1011000111100000 is 0xB1E0

Related Solutions

(a) Convert the decimal numbers, 70 and -26 to binary in the signed 2’s complement system....
(a) Convert the decimal numbers, 70 and -26 to binary in the signed 2’s complement system. Make sure there are enough digits in the results to be able to perform arithmetic operations with these two numbers. (b) Perform in the signed 2’s complement system, (+70) + (-26) (c) Perform in the signed 2’s complement system, (-70) - (-26) (d) Perform in the signed 2’s complement system, (+70) + (+26)
1.convert the following numbers from decimal to binary assuming seven-bit twe's complement binary representation: a)49 b)...
1.convert the following numbers from decimal to binary assuming seven-bit twe's complement binary representation: a)49 b) -27 c)0 d) -64 e) -1 f) -2 g) what is the range for this computer as written in binary and in decimal? 2.convert the following numbers from decimal to binary assuming nine-bit twe's complement binary representation: a)51 b) -29 c) -2 d)0 e) -256 f) -1 g ) what is the range for this computer as written in binary and in decimal?
Convert a list of decimal numbers into their binary and hexadecimal equivalents Add the elements of...
Convert a list of decimal numbers into their binary and hexadecimal equivalents Add the elements of each of these lists to generate a total sum Print the lists, and the total sum of each value C++ contains some built-in functions (such as itoa and std::hex) which make this assignment trivial. You may NOT use these in your programs. You code must perform the conversion through your own algorithm. The input values are: 5 9 24 2 39 83 60 8...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in recursive division form. 899726616 1656906428 -77102817 -251026154
(16%) Convert decimal +47 and +38 to binary, using the signed-2’s-complement representation and enough digits to...
(16%) Convert decimal +47 and +38 to binary, using the signed-2’s-complement representation and enough digits to accommodate the numbers, Then, perform the binary equivalent of (+47)+(-38) and (-47)+(-38) using addition. Convert the answers back to decimal and verify that they are correct.
Convert the following numbers to 8-bit binary and 8-bit hexadecimal: a) 20 b) 78 c) -25...
Convert the following numbers to 8-bit binary and 8-bit hexadecimal: a) 20 b) 78 c) -25 d) -96 Convert the following hexadecimal numbers to binary and decimal assuming two's compliment format: a) 0x56 b) 0x14 c) 0xF8 d) 0xCC MUST DO ALL PROBLEMS AND SHOW ALL WORK!!!!
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers,...
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers, • perform the operation shown, • show all work in binary operating on 4-bit numbers, and • identify overflow if necessary. a) 4 + 2 b) 4 – 2 c) 2 – 4 d) 4 + 4
Convert the following binary values to hexadecimal and decimal (1 pt each) Write Hex Numbers as...
Convert the following binary values to hexadecimal and decimal (1 pt each) Write Hex Numbers as 0x##(ex 0x0A, 0xFF) Binary Hexadecimal Decimal 0001-1011 0x 0000-1000 0000-0100 0000-1001 0001-1111 1001-1001 0111-1010 1100-0010 1110-0101 1000-1010 0011-0100 0001-1001 0100-0011 1111-1111 1110-0111 0001-0010 0100-1000 0100-1110 1001-0001 0110-1100 Name: Convert the following hexadecimal values to binary and decimal Write binary numbers as 0000-0000 Hexadecimal Binary Decimal 0xf1 0xac 0x56 0x6c 0x32 0x30 0x05 0x28 0xf0 0x07 0x42 0xb9 0x6d 0x2f 0x71 0x0e 0x2d 0xfb 0xba...
(6 marks- 3 marks each) The following hexadecimal values are shorthand for 16-bit two’s complement binary...
(6 marks- 3 marks each) The following hexadecimal values are shorthand for 16-bit two’s complement binary numbers. Working purely in hex, negate each and then state whether the result is positive or negative. (a) 5E91 (b) D00F 2.
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal:...
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal: 2. 37 - binary: - decimal: 3. 0A -binary: - decimal: 4. 11 - binary: - decimal:
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT