Little IT school - Lesson 2 |
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Converting decimal numbers into binary ones Decimal numbers are numbers based on number 10. Each figure in some decimal number is a multiplier of number 10 to the power of some number. What does it mean? Here is an example: number 345 = 3*100 + 4*10 + 5*1 = 3* 102 + 4*101 + 5*100
It is similar with binary numbers with the difference that we use number 2 as a base and the powers of number 2, as well as figures 0 and 1 which are used as multipliers for the position in the number. Binary means 2, so we use first two numbers, i.e. 0 and 1. Here are the values of different positions in a binary number:
Binary number 0000 0001
is actually number 1 (decimal)
Binary number 0000 0101
is actually number 5 (decimal)
Here is the method how we transform decimal numbers into binary ones: *We will take number 9 decimal as first example. We divide it by number 2 and write down the rest after divisin, which is number 1, and this number 1 will be the first number on the right side of the binary number. 9/2 = 4 and the rest 1 The result of division, is divided again by 2 4/2=2 and the rest is 0 Again, the result is divided by 2 2/2=1 and the rest is 0 1/2 = 0 and the rest is 1 So, our decimal 9 is 1001 binary (we take the rest numbers from above to the bottom and write them from the right side to the left side) *Second example will be decimal number 14 14/2=7 and the rest is 0 7/2=3 and the rest is 1 3/2= 1 and the rest is 1 1/2 = 0 and the rest is 1 14 decimal is = 1110 binary Let’s check this:
8+4+2+0=14 This means that we transformed the decimal number into binary one well. In this way you can transform any decimal number into binary one. Whatever we enter into a computer, it transforms it into binary numbers because they are convenient for processing inside digital devices. |