How to calculate binary into decimal and decimal to binary!

I thought I would give my self a refresher in this, I learnt how to do it while studying TU100, however over the last couple of months I forgot how to do it. I had to rack my brain to figure it out again!

To find the decimal number of a binary…

To find the decimal value of binary 10001101, we first need to write out the units i.e units, tens, hundreds, thousands etc until you have enough to write the binary number underneath each unit.

128   64   32   16   8   4   2   1  
----------------------------------
1     0    0    0    1   1   0   1

what we need to do is to multiply each binary number by the unit number

1 x 128 = 128
0 x 64 = 0
0 x 32 = 0
0 x 16 = 0
1 x 8 = 8
1 x 4 = 4
0 x 2 = 0
1 x 1 = 1

We then add the answers together to get the decimal value 
128 + 8 + 4 + 1 = 141 


Now, to calculate the binary equivalent of a decimal number.

To find the binary number of a decimal number such as the decimal number of 72.

the principle is nearly the same in that you can write out the units again but do not go beyond what the decimal is so with the number 72 we would write.

64   32   16   8   4   2   1 
----------------------------
1    0    0    1   0   0   0

Now what we need to do is subtract the decimal number from each of the units above.and when we have a positive number we then put the number 1 underneath that unit so first we need to subtract 64 from 72

72 - 64 = 8 so we then put a 1 underneath the unit 64

Now, we cant subtract 32 from 8 as that will give us a negative answer so we put a 0 underneath 32 and again for 16.

the next subtraction is 

8 - 8 = 0 as this is not a negative number we then put a 1 underneath the 8.

Now that we have run out of numbers to subtract the rest of the collum will be filled with zeros. 

the binary value of 72 is 1001000