Edit: Sorry for very silly question, I got it now, if it would have been positive 539, we would not have done 2's compliment at all.

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+20 votes

+26 votes

Best answer

539 = 512 + 16 + 8 + 2 + 1 = 2^{9 }+ 2^{4 }+ 2^{3 }+ 2^{1 }+ 2^{0}

= (1000011011)_{2}

Now all answers have 12 bits, so we add two 0's at beginning = (001000011011)_{2}

To convert to 2's complement invert all bits till the rightmost 1, which will be (110111100101)_{2}

= (1101 1110 0101)_{2}

= (DE5)_{16}

0

Why we are not concerned about the sign of the given decimal number? If in question +539 base 10 was given, will it not change anything?

Edit: Sorry for very silly question, I got it now, if it would have been positive 539, we would not have done 2's compliment at all.

Edit: Sorry for very silly question, I got it now, if it would have been positive 539, we would not have done 2's compliment at all.

+1

If +539 will be given then we will only convert it in binary and from binary by appending zero in MSB by making it easy for grouping , using grouping of 4 we will convert it in hexadecimal.

PS :- In 2's complement representation positive integers are represented in its normal binary form while negative numbers are represented in its 2's complement form

PS :- In 2's complement representation positive integers are represented in its normal binary form while negative numbers are represented in its 2's complement form

0 votes

(-539)_{10}

Decimal Number which is equivalent to -539 in 2's Complement will be

=**N+ 2 ^{n} **

where **N** is Given Number and **n** is range of 2's complement (-2^{n-1} to 2^{n-1} -1) in this case to cover -539 in range we have to take n=11 (-1024 to 1023).

so,

=-539+2^{11}

= -539+2048

=1509

=(10111100101)_{2}

= 1101 1110 0101 (add 1 as MSB to group in 4 bits for Hexadecimal, here we need to take 1 as number is negative.)

=(D E 5)_{16}

- All categories
- General Aptitude 1.3k
- Engineering Mathematics 5.4k
- Digital Logic 2.1k
- Programming & DS 3.8k
- Algorithms 3.3k
- Theory of Computation 4.1k
- Compiler Design 1.6k
- Databases 3k
- CO & Architecture 2.6k
- Computer Networks 3k
- Non GATE 1.1k
- Others 1.4k
- Admissions 496
- Exam Queries 443
- Tier 1 Placement Questions 19
- Job Queries 59
- Projects 9

37,111 questions

44,694 answers

127,237 comments

43,753 users