What are the rules to convert a Decimatnumber into a Binary number? System
Answers
Answered by
2
Answer:
An easy method of converting decimal to binary number equivalents is to write down the decimal number and to continually divide-by-2 (two) to give a result and a remainder of either a “1” or a “0” until the final result equals zero. So for example.
Answered by
1
What are the rules to convert a Decimal number into a Binary number
To convert a signed binary int to a decimal number, use the following algorithm.
We illustrate the algorithm on two four-bit examples: 1110 and 0101.
- If the leftmost bit is a 1, the number is negative. Do the following... (1110 starts with a 1. It's negative.)
- Flip all the bits in the number. (1110 becomes 0001.)
- Add 1 to the number. (0001 + 1 = 0010.)
- Convert the result to base 10 and report its negation. (00102 is 210. The answer is -2.)
- If the leftmost bit is a 0, the number is positive or zero. Convert the number from base 2 to base 10 and report the result. (0101 starts with a 0. 01012 is 510. The answer is 5.)
Note that 1000 is not a special case, although it does seem odd. 1000 starts with 1; so, it's negative. We flip the bits (0111) and add 1 (1000). 10002 is 810 so, the answer is -8. (The odd part is that when we flip the bits and add 1, we get the same number back again!).
Similar questions