Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Counting: Decimal to binary


1. Counting: Decimal to binary

2. Algorithms
An algorithm is a precise step by step method to (eventually) solve a (well-defined) problem.

A major part of computer science is the study of data structures and algorithms.

Aside: A less-precise way of solving a problem based on ideas is called a heuristic.

We will look at an algorithm to convert a decimal number x to binary.

3. Manually
Manual method to convert a decimal number x to binary:

4. Example: manual method
Example: Convert 156d to binary. So, 156d is 10011100b = 27 + 24 + 23 + 22 = 128+16+8+4.

Remember the powers of two from the NCAA basketball tournament problem, 1, 2, 4, 8, 16, 32, and 64.

5. Decimal to binary
The best way to learn base conversion is to practice converting some numbers.

A way to check your conversion work is to use the base converter at Online base converter

6. End of page