Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Digital Literacy Computer Basics Computer Basics Binary

1 Answer

You could break the number like this:

binary: 00000111
--------
1 X 1 = 1
2 X 1 = 2
4 X 1 = 4
8 X 0 = 0
16 X 0 = 0
32 X 0 = 0
64 X 0 = 0
128 X 0 = 0
--------
Total of all the digits' values:
decimal: 7

starting from the right in binary, each digit's value when it is on or a 1 (same thing) is doubled as you go through the numbers. It's value is always 0 if it is off or 0

For example, if we changed the original number from 00000111 to 10000111 (changed the 8th digit from the right from 0 to 1) we would be adding 128 to the number, since that digit is worth 128 when "on"(1) and 0 when "off"(0)

binary: 10000111
--------
1 X 1 = 1
2 X 1 = 2
4 X 1 = 4
8 X 0 = 0
16 X 0 = 0
32 X 0 = 0
64 X 0 = 0
128 X 1 = 128
--------
Total of all the digits' values:
decimal: 135

Hope this helps.

Thanks Simon for pointing out error

Simon Coates
Simon Coates
28,692 Points

you forgot to change the 1 in 128 X 0 on the second demo.