Introduction: Convert Decimal to Binary and Vice Versa
This is a technique that helped me out a lot when learning about AND OR NOR gates, creating subnet masks and helped me pass time seeing how high I could get with the binary sequence (not very far). I was able to teach my son this method when he was 7 or 8.
I plan to eventually make this a Computer Science Collection of Instructables to help teach kids. If anyone would like to help out, provide suggestions and/or write Instructables for this collection let me know.
I keep seeing my Assembly Language Quick Reference Guide on my desk.... There's nothing quick about Assembly at least not for me.
Step 1: Binary Sequence
The key to this method is laying out the numbers binary sequence which is powers of 2 since binary is base 2. This that much more difficult than counting by 2's. Note that we use base 10 considering we have 10 digits and computers at their lowest level use base 2. People argue that some computers use base 16 but remember that a switch is either on or off, 1 or 0. The numbers will need to be from right to left the lowest number to the highest number. This is illustrated by the second picture in the collection.
Step 2: Binary to Base 10
Here we will use the sequence table (2nd Image) to find the base 10 number. Use the visual (1st image) to get a better idea of how this works.
So here you have a given binary number.
- You will fill in the table from right to left with the 1's & 0's from the binary number.
- You will find the decimal numbers that have a 1 and not a zero. Remember that 1 is on and 0 is off.
- Add the decimal numbers you found in the previous step together to get the decimal value of the binary number that you were given.
Step 3: Decimal to Binary
Here we will use the sequence table (2nd Image) to find the base 2 number. Use the visual (1st image) to get a better idea of how this works.
So here you have a given decimal (base 10) number.
- Find the highest number that will go into your given decimal number.
- Place a 1 in the table for each number that you were able to subtract.
- Subtract that number from your decimal number.
- Find the next highest number that will go into the number from number 3.
- Repeat steps 1-5 until you have a zero remainder.
- Your binary number will not start with zero but everywhere else that you have a blank fill in a zero (see example)
Step 4: Try It for Yourself
We have a be nice policy.
Please be positive and constructive.