Question:
binary code help ??????????????????
2009-02-17 16:31:51 UTC
we are learning binary code in computers class and i dont understand it
can someone please explain to me how u get 0s and 1s from other numbers
someone plz explain
Five answers:
-: ViRuS :-
2009-02-17 17:12:19 UTC
It's simple; just understand the concept of 'Counting' with base 10, base 8, base 15 or base 2.



If you count from 0 to 9 (base of 10). 0 1 2 3 4 5 6 7 8 9 (10 digits)

Q: what is the next number after 9? It's 10.

(we add 1 next to zero then we start counting again)



If you count from 0 to 15 (base 16 or Hex) 0 1 2 3 4 5 6 7 8 9 A B C D E F

Q: How do you write 16 in Hex? it's 10

(we added 1 next to zero then we start counting again)







If you count from 0 to 7 (base 8 or octo) 0 1 2 3 4 5 6 7 (8 digits)

Q: How do you write 8 in Octo?







If you count from 0 to 1 (binary or 2 digits only) 0 1

Q: How do u write 3 in binary? It's 11.

Q: How to u write 4 in binary? it's 100.



When you get the concept of counting in Binary, Octo, Hex and Decimal, then find out the math formula how to convert binary to (Decimal or Hex or Octo).



you can write your own programs to do this.
Andy T
2009-02-17 16:51:42 UTC
OK, the very fundamental is that all computers since WWII or sometime like that work in binary, this is the very basic here, next is the conversion of numbers in any bases, there are two algebraic formulae, they are human_base_10 to and from base_x:



recursion:

answer = answer append if number != 0 { number % base_x; number = number integer division base_x; goto recursion; } else if number == 0 append 0



That was turning an ordinary number into a base x number; the other direction:



sum(y=0..digits - 1, digits[y] * base_x^y)
mathematix
2009-02-17 16:39:25 UTC
OK, from right to left. Place holder's are

_ _ _ _ _ _ _ _

128 64 32 16 8 4 2 1



1 means the value below it is ON. 0 Means the value below it is off.

so

1 0 0 1 0 1 1 1

_ _ _ _ _ _ _ _

128 64 32 16 8 4 2 1



Since 1 is over the 1, 2, 4,16,128 it means those values are on.

So you add all of the ON values and you get: 151.



Finally, just remember

The place holder goes from right to left,

Starts at 1,

doubles each time it moves to the right,

if there is a 1 over it it means that value is ON

add of all of the ON values,

It helps to write the place holders under the numbers for a visual aid(especially on a test).



If you have anymore questions leave it in the additional details and I will try to get back to you.



GOOD LUCK!
Pegleg7
2009-02-20 17:13:07 UTC
For learning binary, it helps to have a converter that works really fast. The one at http://www.digitconvert.com/ can do binary to decimal (and vice versa) in real time. I think it will help you to see these conversions done at any speed you will them.
Eddie Lee H.
2009-02-17 16:55:27 UTC
Think of binary like the light switch in your room that turns on and off your ceiling light.



0 is off

1 is on



This is also called base 2, because there are only 2 numbers.



Think about the numbers you already know. They are called base 10 because when you get to 9 you start over at 10, same thing when you get to 99 you start over at 100. So it is base 10, because there are 10 numbers 0 1 2 3 4 5 6 7 8 9 used to build every number.



Back to base 2



Now think about some other light switches in your house that are side by side. So you can have two lights off or on or one off and one on.



With a pair of switches you can count from 0 to 3 because there are 4 different combinations.



00 = off off = 0 in base 10

01 = off on = 1 in base 10

10 = on off = 2 in base 10

11 = on on = 3 in base 10



Notice that you always use 0 and 1, so it is base 2, because there are only 2 numbers used to build every number.



What if you have 3 light switches next to each other and you can turn off or on 3 different lights. How many different combinations are there? There are 2 to the power of 3 combinations or 2 times 2 times 2 = 8



000 = off off off = 0 in base 10

001 = off off on = 1 in base 10

010 = off on off = 2 in base 10

011 = off on on = 3 in base 10

100 = on off off = 4 in base 10

101 = on off on = 5 in base 10

110 = on on off = 6 in base 10

111 = on on on = 7 in base 10



Now you try this with 4 light switches. You can have 2 to the power of 4 combinations, or 2 * 2 * 2 * 2 = 16 different combinations, or you can count from 0 to 15 in base 2.



You can keep doing this forever.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...