Converting Numbers Into Octals - CCNA


Other than binary, computers also use Octals and Hexadecimals. I'll be completely honest, I don't know what Octals and Hexadecimals are used for, at least not well enough to provide you all a clear and exact answer. I can tell you from asking around that Octals and Hexadecimals, where more or less used for sprites in basic.

For both the base of 8 and base of 16, you can use the same method as we used in binary in order to convert base of 10 into base of 8 or 16: Division and save the rest. If you don't already, your goal is to find the closest whole number that the number you are dividing by can go into. So, if divide 5/4, 4 can only go into 5 one time, and leaves us with a rest of 1. It's basically like using modulo (%), as it finds the remainder.

Let's say we want to convert the number 120 in the base of 10 to base of 8. We simply have to divide 120 by 8.

120/8= 15 and has a rest of 0
15/8=1 and has a rest of 7
Finally, 1/8 has a rest of 1

Thus, when you take the rest from the most recently calculated, you find that 120 of the base 10 is equal to 170 in the base of 8.




Update: Originally, I had talked about how this is also easily applicable to base of 16, and it is! But, it is also a little more complicated than that. Base of 16 looks like this: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, etc.}. After a certain point you will start getting conversions like B4, but I don't feel like I know how to explain it well enough in this moment in time to properly teach you how to do it exactly right. I'd much rather be posting about things that I'm sure about, than something that I am half sure about.


Comments

Popular Posts