Do looking at a bunch of '0' and '1' makes you feel like a hacker or something? It just a number, but represented using only '0' and '1'.
First, why computer uses '0' and '1' instead of the numbers we use in daily life? Binary acts like a switch, '0' means Off while '1' means On. So, have 8 switches together would makes you a byte, which is enough to type an alphabet.
A bunch of binary numbers will form a character based on the code assigned by the computer (The ASCII code). For example, the alphabet 'A' have a code of '65' in decimal and '01000001' in binary.
Recalling your mathematic lesson
To understand binary, we have to recall your primary school mathematics. Teacher will tell you to put number in different place value, like Hundreds (H), Tens (T) and Ones (O).
H | T | O
1 | 9 | 3
As you know, hundred is 100, ten is 10 and one is 1.
So, to calculate how much is the number, we multiply the amount of it like so:
100 * 1 = 100
10 * 9 = 90
1 * 3 = 3
And we add them together, like so :
100 + 90 + 3 = 193
So, the answer is 193, very easy, right?!
At a glance, place value just work like this :
10^2 | 10^1 | 10^0
1 | 9 | 3
Binary Part
Now, instead of having 10 digits (0-9) in a place value, we only use 2 digits (0 and 1) in a place value, which changes the calculation slightly:
2^2 | 2^1 | 2^0
So, can you calculate the 101 in binary now?
2^2 | 2^1 | 2^0
1 | 0 | 1
2 ^ 2 = 4
2 ^ 1 = 2
2 ^ 0 = 1
4 * 1 = 4
2 * 0 = 0
1 * 1 = 1
So the answer is 5!
Really easy huh? Although I teaches you to count step by step...
Now calculate 10010110 for me!
2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0
1 | 0 | 0 | 1 | 0 | 1 | 1 | 0
128 + 16 + 4 + 2 = 140
Now proof how 'professional' you are to your friends!
No comments :
Post a Comment