Computers: The Past, Present, and FutureChanging Picture
Main Past Present Future Interviews Java About Us
  Computers: Present: Topics 

Forums
Search
Email
Site Map
Related Links

 


Decimal to Binary

Converting Decimal to Binary is the same algorithm as Binary to Decimal, except reversed. 
First, determine the amount of binary digits you need to have for your number. For this example, we are going to use 74. Therefore, determine the max value binary that you need for your number. Here is how you to do it. Spread out your numbers as before and place the power of 2 under it.
   1    1    1    1    1    1    1    1
(128) (64) (32) (16) (8)   (4)    (2)   (1)
In observing this, you should realize you need only 7 binary digits. This is because the eighth binary value is greater than the one we are converting. Now, you need to determine which values need to be ON or OFF. To do this, begin adding up your numbers from the left. After each addition, compare your current number to the one you are trying to convert. If it is larger, then assign the value you last added to zero. 
    1      0     0     1     0     1     0
(64) + (0) + (16) + (8) + (0) + (2) + (0) = 72
Therefore, 1001010 is equal to 72. 



 Search | Site Map | Email (link disabled) | Forums
 Main | Past | Present | Future | Interviews | Java | About Us

All material and images on these pages are copyright Joseph,Ed. This page was developed for the Thinkquest1999 competition.