Friday, August 19, 2011

how to convert decimal to binary and binary to decimal


HOW TO CONVERT DECIMAL TO BINARY AND BINARY TO DECIMAL

For converting a number from decimal to binary we use repeated division by 2 method. We continue the repeated division by 2 till we get the number less than 2. For example:

Repeated division method:
Divide the decimal number by 2 and store remainder at one place. Continue this process till the decimal number is less than 2. Finally write the remainders in reverse order:

You will understand this concept by this example:
 If we want to convert decimal number 65 to binary, we can do this as following:

Divisor 2
Decimal Number and quotients
Remainder
2
65
2
32
1
2
16
0
2
8
0
2
4
0
2
2
0
2
1
0

0
1
   
Now writing the remainders in reverse order we get 1000001
So Decimal number 65 is 1000001 in binary
One more example:
Convert 45 from decimal to binary
 
Divisor 2
Decimal Number and quotients
Remainder
2
45

2
22
1
2
11
0
2
5
1
2
2
1
2
1
0
2
0
1

Writing the remainders in reverse order we get 101101 which is binary equivalent of 45.

Now if we want to convert vice versa i.e. from binary to decimal, we can use the following method:

Take each digit of binary number from right to left and multiply the digit with 2n in increasing order. Here n starts with 0 and increases by 1. Finally add the individual terms and get the decimal number. You will understand this concept by the following example:


Converting 101101 to decimal

1x25+0x24+1x23+1x22+0x21+1x20

=32+0+8+4+0+1
=45
So the decimal equivalent of 101101 is 45

I hope you have understood the process of converting decimal to binary and vice versa. Your comments are welcome

No comments:

Post a Comment