Got this problem when I played a riddle..The clue was in decimal, should be converted to hexadecimal. Actually, it's simple, just do googling and you'll get the converter, problem solved. But, when I played the riddle I was using my cellphone with operamini. So, I couldn't use the converter :(. Furthermore, the calculator in my cellphone just a basic calculator not the scientific version...
I didn't want to wait till get home then do googling using laptop or using the calculator, so I tried to get the manual calculation. I've been taught about the base in my 2nd year of Junior High School, so I believed I could found out the conversion secret :)
First, I made this table..
DECIMAL | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
HEX | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Recalling the memory from 10 years ago......
The conversion using a tree factor (Well, in Bahasa Indonesia is Pohon Faktor, just guessing the english term is tree factor :P)
Finalllllyyy...
I got it.. I got it..
Example:
Convert this decimal number to hexadecimal
703710
703710
- 703710 :16 = 43981,875 --> 43981 + (0.875) --> 0.875 x 16 = 14
- 43981:16 = 2748,8125 --> 2748 + (0.8125) --> 0.8125 x 16 = 13
- 2748:16 = 171,75 --> 171 + (0.75) --> 0.75 x 16 = 12
- 171:16 = 10,6875 --> 10 + (0.6875) --> 0.6875 x 16 = 11
- 10 --> the calculation ends here because it is smaller than 16.
So...what is the hexadecimal number from (703710)dec??
change it to hexadecimal formsee the bold number..arrange it from the bottom, so it becomes:
10 11 12 13 14
10 11 12 13 14
10 | 11 | 12 | 13 | 14 |
A | B | C | D | E |
Yup.. (703710)dec = (ABCDE)hex
Now..how to convert hex number to dec number?
just the similar ways..
Convert the (ABCDE)hex to decimal
- There is 5 digit hex number --> n = 5
- (A)hex = (10)dec --> 10 x 16^4 = 655360 (4 = n-1)
- (B)hex = (11)dec --> 11 x 16^3 = 45056 (3 = n-2)
- (C)hex = (12)dec --> 12 x 16^2 = 3072 (2 = n-3)
- (D)hex = (13)dec --> 13 x 16^1 = 208 (1 = n-4)
- (E)hex = (14)dec -->14 x 16^0 = 14 (0 = n-5)
Sum the bold numbers:
655360 + 45056 + 3072 + 208 + 14 = 703710
655360 + 45056 + 3072 + 208 + 14 = 703710
No comments:
Post a Comment
Comment please..thanks