CSE 111, Fall 2004

Algorithm: Convert 8-Bit Binary B to Decimal D

Last Update: 8 September 2004

Note: NEW or UPDATED material is highlighted


  1. Input B;

  2. Going from right to left, write the decimal values of the binary places underneath each place;

    1. To do this, start by writing 1 under the first place on the right;
    2. Then double each value as you move to the left;

    1. Add the decimal values that are underneath 1's;
    2. Let D = this number;

  3. Output D;

  4. Stop.

Test this with:
  1. B = 11111111
  2. B = 01101101
  3. B = 10010010
  4. B = 01111111
  5. B = 00000010
  6. B = 00000000

Question to think about:
  1. Steps 2a and 2b are an attempt to make step 2 more precise. Can you explain it in even more detail?



Copyright © 2004 by William J. Rapaport (rapaport@cse.buffalo.edu)
file: 111F04/bin2dec-alg-2004-09-08.html