Conversion of decimal into binary
Example 1:
Convert decimal number 117 into binary ?
Note: You should always move from left to right.
Solution:
Base position 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
Decimal value 128 64 32 16 8 4 2 1
Bit status 0 1 1 1 0 1 0 1
We can also check through adding only "1"s bit in the table which is shown above.
64 + 32 + 16 + 4 + 1 = 117
Rough note: We can do like this adding method given below;
Decimal calculation Bit in binary
128 is greater than 117 off the bit
0 + 64 = 64 is less than 117 on the bit
0 + 64 + 32 = 96 is less than 117 on the bit
0+ 64 + 32 + 16 = 112 is less than 117 on the bit
0 + 64+ 32 + 16 + 8 = 120 is greater than 117 off the bit
0+ 64 + 32 + 16 + 0 + 4 = 116 is less than 117 on the bit
0+ 64 + 32 + 16 + 0 + 4 + 2 = 118 is greater than 117 off the bit
0+ 64 + 32 + 16 + 0 + 4 + 0 + 1 = 117 is equivalent to 117 on the bit
This is another way of doing this calculation in which we can also do like this subtracting method which is given below;
Decimal calculation
117 - 128 cannot be subtracted because 128 is greater than 117
117 - 64 = 53 is less than 117
53 - 32 = 21 is less than 53
21 - 16 = 5 is less than 21
5 - 8 cannot be subtracted because 8 is greater than 5
5 - 4 = 1 is less than 5
1 - 2 cannot be subtracted because 2 is greater than 1
1 - 1 = 0 at last we got the value equal to 0
Therefore, this is the binary value of 117 is 01110101.
No comments:
Post a Comment