Anda di halaman 1dari 10

# Binary!

## Binary means two things.

0 or 1 on or off left or right up or down

1011 11

1 100

1111010

## Base 10 Numbers- aka "decimal"

10 possible values
100 10 1

3 4 7
means there are three 100s 3 x 100 means there are four 10s 4 x 10 means there are seven 1s + 7x1

300

40 +

= 347

0 1 2 3 4 5 6 7 8 9

## Base 2 Numbers- aka "binary"

2 possible values

0 1
256 128 64 32 16 8 4 2 1

1 0 1 0 1 1 0 1 1
1 x 256 0 x 128 1 x 64 0 x 32 1 x 16 1x8 0x4 1x2 + 1x1 means there is one 256 means there are zero 128s means there is one 64 means there are zero 32s means there is one 16 means there is one 8 means there are zero 4s means there is one 2 means there is one 1

256 + 0 + 64 +

0 + 16 +

+ 2

+ 1 = 347

0 - 15 in binary!
8 4 2 1 8 4 2 1

0
8 4 2 1

=0

1
8

0
4

0
2

0
1

=8

1
8 4 2 1

=1

1
8

0
4

0
2

1
1

=9

1
8 4 2

0
1

=2

1
8

0
4

1
2

0
1

= 10

1
8 4 2

1
1

=3

1
8

0
4

1
2

1
1

= 11

1
8 4

0
2

0
1

=4

1
8

1
4

0
2

0
1

= 12

1
8 4

0
2

1
1

=5

1
8

1
4

0
2

1
1

= 13

1
8 4

1
2

0
1

=6

1
8

1
4

1
2

0
1

= 14

=7

= 15

What's 16 in binary?

0 - 15 in binary!
8 4 2 1 8 4 2 1

=0
8 4 2 1 8 4 2 1

=8

=1
8 4 2 1 8 4 2 1

=9

=2
8 4 2 1 8 4 2 1

= 10

=3
8 4 2 1 8 4 2 1

= 11

=4
8 4 2 1 8 4 2 1

= 12

=5
8 4 2 1 8 4 2 1

= 13

=6
8 4 2 1 8 4 2 1

= 14

=7

= 15 What's 16 in binary?

## How do you convert a "regular" number to binary?

To convert a "regular", base-10 number to a binary, base-2 number, you need to gure out how many of the "binary numbers" are in it. The "binary numbers" are 1, 2, 4, 8, 16, 32, 64, 128, and so on forever.
What comes after 128? And after that number?

## To convert to binary, follow these steps:

1) Write down the number you want to turn into binary.

43

2) Write down the binary numbers with boxes underneath, starting with 1 and going to the left, until you write one that is larger than your target number, which in this case is 43.

64 is larger than 43 64 32 16 8 4 2 1

43

3) Write a 0 under the last number you wrote, which in this case is 64, because your target number, 43, does not have 64 in it.

64 32 16 8 4 2 1 0

43

4) Your target number, 43, does have 32, the next binary number, in it, so write down a 1 under it and then subtract 32 from 43 to get 11. 5) The next binary number, 16, is larger than 11, so write down 0 underneath it. There are no 16s in 11.

64 32 16 8 4 2 1 0 1

43 - 32 = 11

64 32 16 8 4 2 1 0 1 0

11

continued...

6) The next binary number is 8. There IS an 8 in 11, so write a 1 underneath it and subtract 8 from 11.

64 32 16 8 4 2 1 0 1 0 1

11 - 8 = 3

7) The next binary number is 4, which is greater than 3, so write a 0 underneath 4. There are no 4s in 3.

64 32 16 8 4 2 1 0 1 0 1 0

6) The next binary number is 2. There is one 2 in 3, so write a 1 underneath 2 and subtract it from 3.

64 32 16 8 4 2 1 0 1 0 1 0 1

3-2=1

7) And the nal binary number is 1. There is obviously a 1 in 1, so write 1 underneath 1 and subtract 1 from 1. Since that gives us 0, we're all done!

64 32 16 8 4 2 1 0 1 0 1 0 1 1

1-1=0

8) We can drop the leading zero (the one under 64) to get 101011, which is equal to 43.

101011 = 43

32

16

1 0 1 0 1 1
1 x 32 0 x 16 1x8 0x4 1x2 1x1

32

0 +

= 43

## Now you try!

32 16 8 4 2 1

= 43

32 + 0 + 8 + 0 + 2 + 1 = 43

32

16

32

16

32

16

32

16

32

16

32

16

32

16

32

16

32

16

32

16

32

16

What is 12 in binary?
16 8 4 2 1

What is 27 in binary?
32 16 8 4 2 1

What is 54 in binary?
64 32 16 8 4 2 1