Plz write how we can do it by self. question is :
(501) base-8 to Hexa.
(501) base-8 to Hexa.
-
The easiest way is to convert Octal to binary and then convert the binary to hex. Sounds harder than it really is because you can do these conversions by simply swapping digits with a binary patterns.
No heavy math is required and this bit pattern matching works because base8 and base16 are multiples of base2. All you need to understand is how to count from 0 to 15 in binary and that each digit in an Octal number can be represented by a 3 digit binary. (Each Hex digit can be represented by a 4 digit binary
Octal uses 8 digits (0 to 7) and Hex uses 16 (0 to 9 plus A,B,C,D,E & F).
Let's start the conversion from Octal to Binary by replacing each Octal digit with its 3 digit binary equivalent
5 becomes 101
0 becomes 000
1 becomes 001
Stick all of these binary digits together and you get 101000001
Next convert groups of four binary digits into Hex digits. Start at the right most digit (least significant bit). I will place a comma as a separator between the groups
1,0100,0001 notice the left most group doesn't have four digits, That's OK as you can consider this left group to have leading zeros
0001,0100, 0001
Now that you have this binary broken up into groups of 4 binary digits you can convert the binary group value into a HEX digit (0 to F)
0001 becomes 1
0100 becomes 4
0001 becomes 1
The hex value is 141
Recap:
(base8) 501 = (base2) 000101000001 = (base16) 141 = (base10) 321
No heavy math is required and this bit pattern matching works because base8 and base16 are multiples of base2. All you need to understand is how to count from 0 to 15 in binary and that each digit in an Octal number can be represented by a 3 digit binary. (Each Hex digit can be represented by a 4 digit binary
Octal uses 8 digits (0 to 7) and Hex uses 16 (0 to 9 plus A,B,C,D,E & F).
Let's start the conversion from Octal to Binary by replacing each Octal digit with its 3 digit binary equivalent
5 becomes 101
0 becomes 000
1 becomes 001
Stick all of these binary digits together and you get 101000001
Next convert groups of four binary digits into Hex digits. Start at the right most digit (least significant bit). I will place a comma as a separator between the groups
1,0100,0001 notice the left most group doesn't have four digits, That's OK as you can consider this left group to have leading zeros
0001,0100, 0001
Now that you have this binary broken up into groups of 4 binary digits you can convert the binary group value into a HEX digit (0 to F)
0001 becomes 1
0100 becomes 4
0001 becomes 1
The hex value is 141
Recap:
(base8) 501 = (base2) 000101000001 = (base16) 141 = (base10) 321
-
First convert octal number to binary no
501 base8 to binary tat is base2
5=101
0=000
1=001
then convert binary to hexa 101000001
0001/0100/0001
1 4 1
answer is 141 base16
501 base8 to binary tat is base2
5=101
0=000
1=001
then convert binary to hexa 101000001
0001/0100/0001
1 4 1
answer is 141 base16
-
Use Windows calculator in programmer (W7) or scientific mode (XP). You can enter your number in octal, click on hex and it will convert it.