Please go through the solution given below.If find any
difficulty,feel free to ask in comment section.Please do upvote the
answer.Thank you.
Converting 2's
complement binary to decimal form procedure
- Check the left most digit of the number which represent the
sign
- If it is 0, then the number is positive and if it is 1,then the
number is negative
- If the number is positive,simply convert it into decimal.This
is done by sum up the product of each bit and their
weight(20,21,22,....)
- If the number is negative make it positive by inverting the
bits,all 0's to 1's and all 1's to 0's and add 1 to it.
- Then convert the result obtained to decimal.
- The negative of this decimal number is the decimal form of the
original binary number
a)1100010
- The left most digit of the number is 1.So the number is
negative
- Invert all bits and add 1
- 0011101+1 =0011110
- Convert 0011110 to decimal
- 0011110 = 1x24+1x23+1x22+1x21+0x20 = 16+8+4+2+0= 30
- So the decimal equivalent of 1100010 is
-30
b)0101010
- The left most digit of the number is 0.So the number is
positive
- Convert 0101010 to decimal
- 0101010 =1x25+
0x24+1x23+0x22+1x21+0x20
= 32+0+8+0+2=42
- So the decimal equivalent of 0101010
is 42