Hello!
Let's make a list of decimal numbers: 4, 5, 10, 15, 49, 71, 100, 111, 189, 255.
And convert them into their binary representation. A hope you know that binary number system is a positional one and has only two digits, 0 and 1. Each next (to the left) one "costs" twice as the previous digit.
So 1_dec=1_bin but 2_dec=10_bin, 3_dec=11_bin and so on.
There are at least two ways to convert decimal to...
Hello!
Let's make a list of decimal numbers: 4, 5, 10, 15, 49, 71, 100, 111, 189, 255.
And convert them into their binary representation. A hope you know that binary number system is a positional one and has only two digits, 0 and 1. Each next (to the left) one "costs" twice as the previous digit.
So 1_dec=1_bin but 2_dec=10_bin, 3_dec=11_bin and so on.
There are at least two ways to convert decimal to binary. The first starts from the least significant digit and moves to the left, the second is vice versa. In the first method we consecutively divide by 2 and watch for the remainder, In the second consecutively determine the most degree of 2 which is not greater than our number.
Use the first method for the first five numbers.
1. 4 is divisible by 2, so it has 0 at the end (no ones), the quotient is 2. 2 is also divisible by 2, so 0 again, the quotient is 1. And 1 isn't divisible by 2, so 1.
The answer is `100_(bi n).`
2. 5 isn't divisible by 2, so the remainder is 1 and the quotient is 2. 2 gives the remainder 0 and the quotient 1, 1 is 1. So the answer is `101_(bi n).`
3. 10: 0, 1, 0, 1, i.e. `1010_(bi n).`
4. 15: 1, 1, 1, 1, i.e. `1111_(bi n).`
5. 49: 1, 0, 0, 0, 1, 1, i.e. `110001_(bi n).`
Use the second method for the second five numbers.
6. 71: `2^7=128gt71gt=64=2^6,` so 1 at the 7-th position (for `2^6`). 71-64=7, so zeros for 32, for 16 and for 8. Then 1 for 4, 7-4=3, so 1 and 1.
So the answer is `1000111_(bi n).`
7. 100: 1 for 64, 100-64=36. 1 for 32, 36-32=4. 0 for 16, 0 for 8, 1 for 4, 4-4=0 so 0 for 2 and 0 for 1.
The answer is `1100100_(bi n).`
8. 111: 1, 1, 0, 1, 1, 1, 1. The answer is `1101111_(bi n).`
9. 189: 1, 0, 1, 1, 1, 1, 0, 1. The answer is `10111101_(bi n).`
10. 255 is `11111111_(bi n)` (try it yourself :) ).
No comments:
Post a Comment