To convert hex to binary and octal to binary are direct conversions.
A hex digit will form a binary number of 4 bits (binary digits)
An octal digit will form a binary number or 3 bits.
So
2AD
will become
0010 1010 1101
and
234 octal
will become
010 011 100
To convert from hex to octal and octal to hex it is therefore easier to go via binary because this is a simple conversion.
If I take my first hex example 2AD
0010 1010 1101
Group this into threes from the right
001 010 101 101
is
1255 octal.
Also use the windows calculator in scientific mode to check your answers.
I hope this helps.
?
2016-05-23 19:15:56 UTC
Binary is easy enough: set string var to '' while number >=2 get your number divide it by 2 if the remainder is 1 add '1' to end of string if remainder is 0 add '0' to end of string. end while The same kind of idea will hold for octal but for hex you're going to need to use a case statement to figure out the ABCDEF bits. Hope that helps!
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.