Fairly detailed response
dduardo said:
I'm sure your familiar with the decimal(base 10) system: 0,1,2,3,4,5,6,7,8,9
Binary(base 2) is: 0,1
Hexadecimal (base 16) is : 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F
we use a base 10 system like he said which is 0-9 or ten digit. you may not realize it but numbers are created by the rules of base ten.
our numbers say 352 are made up of combinations of base ten
3------5---------2
10^ 2 --10^1-----10^0
for biger numbers u would just continue the pattern
number
143,251
1---------4---------3---------2---------5-------1
10^5------10^4-------10^3-------10^2------10^1---10^0
we know we need to add another digit when we get higher than 9 which is the same when its in other bases except the digit you can go up to is different
in binary like he said you can only use 0 or 1
so you would count 0,1,2,3,4,5,6,7,8,9,10 in base ten and
Base 2 Base 10 equivilent Hex
(binary)
0 1 1
01 2 2
10 3 3
11 4 4
100 5 5
101 6 6
110 7 7
111 8 8
1000 9 9
1001 10 A
1010 11 B
1011 12 C
1100 13 D
1101 14 E
1110 15 F
1111 16 10
1001 17 11
It goes the same way
lets say we have 352 in base 10
what is that in binary
well let's do what we did for base 10 except with base 2
2^9--2^8----2^7----2^6----2^5---2^4---2^3----2^2-----2^1----2^0
512--256----128-----64------32----16-----8-------4-------2------1
now we take 352 and substract the first number under it that it can go into
so 512 is to big-- so we move to 256 and we can take 1 256 out of 352 (in binary it will always be one or 0 but it changes for differnent bases-- you will always at max be able to take the base number of times out of the orgiinal number) so
lets do it
352-256=96 (and you put a one on top of the 2^8 to represent you can take the 256 out)
0 ---1
2^9--2^8---- 2^7---- 2^6--- 2^5-- 2^4-- 2^3-- 2^2---2^1-----2^0
512----256--- 128---- 64----32-----16----8-----4-------2-------1
So now your left with 96
you can't take 128 out of 96 so you put a 0 there
continue in this fashion until you get the following
352-256=96
128 to big so 0 in 2^7
96-64=32 so one on top of 2^6
32-32=0 so one on top of 2^5
therefore since your are out the rest are zeros
0----1-------0------1 -------1-----0 ----- 0-------- 0--------0------0
2^9-- 2^8--2^7----2^6-----2^5--- 2^4--- 2^3----2^2-----2^1----- 2^0
512---256---128 -----64------32 ----- 16--- 8-------4--------2------1
so the binary representation of 352 is
0101100000
u don't need the leading 0 so
101100000
you can use this method to test the following numbers
13 = 1101
234 = 11101010
456 = 111001000
2547 = 100111110011
Now let's do the same thing for hex
take 352 again
we set it up the same way
we say 4096 is too big so we move down to 256 and see 256 can be taken out once so we put a one there
352-256=96
Now how many times can 16 go into 96:
the answer is 6 so we put a 6 there
96- 6(16)=0
0-------1-------6-------0
16^3----16^2---16^1----16^0
4096-----256-----16-------1
so the hex representation of 352 base 10 is 160
now let's try a harder one
take
9453
65536 is obviously too big so we move on to 4096
how many times can 4096 go into 9453
the answer is 2 so u put a 2 in on top of it
9453-2(4096)=1261
so we continue
how many times can 256 go into 1261
the answer is 4
so 1261-4(256) = 237
--0--------2--------4
16^4-----16^3----16^2---16^1----16^0
65536-----4096----256------16-----1
Now is where it gets tricky
how many times does 16 go into 237
the answer is 14--- but you can't put 14 in there because it needs to be a single digit-- that's when you remember that unlike base 2 which only has 2 digits or base 10 which has 10 digits (0-9) base 16 has 16 digits
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
just remember you treat the letter as you would the base 10 number -- just continue the sequence
so A is 10
B is 11
C is 12
D is 13
E is 14
F is 15
so instead of us saying 16 goes into 237 14 times we would say it goes into it E times
---0-------2--------4------E
16^4-----16^3----16^2---16^1---16^0
65536----4096------256----16 ------ 1
then we continue in the same fashion
so 237-E(16) or 237-14(16)= 13
so how many times does 1 go into 13
13 times
but remember what we just learned
we can't put 13 so we put D instead
10-A
11-B
12-C
13-D
----0------2--------4------E-------D
16^4----16^3----16^2---16^1---16^0
65536----4096-----256-----16------1
so the hex representation of 9453 is 24ED
here are some more for practice
173 - AD
8923 - 22DB
21723 - 54DB
66123 - 024B
ok that should do it for now i need to finish my homework
anyway here are some final tips
when you go from higher base to lower base
aka say from base 10 to 2
the number will always increase
when you go from lower base to higher the number will always decrease
note hopefully it will all line up
it did when i made it