Computer Science, asked by mona5874, 11 months ago

1's and 2's complement for 13

Answers

Answered by gurukulamdivya
6

Answer:

1. We start with the positive version of the number:

|-13| = 13

2. Divide the number repeatedly by 2, keeping track of each remainder, until we get a quotient that is equal to zero:

division = quotient + remainder;

13 ÷ 2 = 6 + 1;

6 ÷ 2 = 3 + 0;

3 ÷ 2 = 1 + 1;

1 ÷ 2 = 0 + 1;

3. Construct the base 2 representation of the positive number, by taking all the remainders starting from the bottom of the list constructed above:

13(10) = 1101(2)

4. Determine the signed binary number bit length:

The base 2 number's actual length, in bits: 4.

A signed binary's bit length must be equal to a power of 2, as of:  

21 = 2; 22 = 4; 23 = 8; 24 = 16; 25 = 32; 26 = 64; ...

First bit (the leftmost) indicates the sign,  

1 = negative, 0 = positive.

The least number that is a power of 2 and is larger than the actual length so that the first bit (leftmost) could be zero is: 8.

5. Positive binary computer representation on 8 bits - if needed, add extra 0s in front (to the left) of the base 2 number, up to the required length:

13(10) = 0000 1101

6. To get the negative integer number representation on 8 bits, signed binary one's complement, replace all the bits on 0 with 1s and all the bits set on 1 with 0s (reversing the digits):

!(0000 1101) = 1111 0010

7. To get the negative integer number representation on 8 bits, signed binary two's complement, add 1 to the number calculated above:

1111 0010 + 1 = 1111 0011

Conclusion:

Number -13, a signed integer, converted from decimal system (base 10) to a signed binary two's complement representation:  

-13(10) = 1111 0011

Answered by Manmohan04
0

Given:

A signed integer number in the base 10 decimal system is 13.

To Find:

The one's and two's complements of 13.

Solution:

First, we will convert the given decimal number into its binary equivalent.

For this, we divide the number repeatedly by 2 until we get a quotient that is equal to zero. For each division, we keep noting the remainder.

\[13 \div 2 = 6\], Remainder \[ = 1\]

\[6 \div 2 = 3\], Remainder =0

\[3 \div 2 = 1\], Remainder \[ = 1\]

\[1 \div 2 = 0\], Remainder \[ = 1\]

Writing all the remainders starting from the bottom of the above list, we obtain the equivalent binary number as:

\[{13_{\left( {10} \right)}} = {1101_{\left( 2 \right)}}\]

Now, the sign-magnitude representation of +13 will be 01101. Here, the sign bit is 0 since the number is positive.

We know that the signed binary one's and two's complement form of a positive number is the same as its sign-magnitude form.

Hence,

The one's complement of 13 is 01101.

The two's complement of 13 is 01101.

Thus, the one's and two's complement of 13 is 01101.

#SPJ2

Similar questions