octal to hexadecimal

Thread Starter

armic

Joined Feb 2, 2009
2
hi,im stucking in the program c about to write a programe to convert a 4-digit octal number X into the corresponding hexadecimal number Y.
i know exactly how octmal convert to hexa numbers but i dont know how to write them out
 

bertus

Joined Apr 5, 2008
23,005
Hello,

The Octal numbering goes from 0 to 7 (each number is 3 bits).
The Hex numbering goes from 0 to F (each number is 4 bits).
When you write out the numbers, the 4 digit Octal has 4 X 3 bits = 12 bits.
When you write out 12 bits in Hex it wil be 12 / 4 = 3 digits.

Greetings,
Bertus
 

beenthere

Joined Apr 20, 2004
15,819
Write out two columns of numbers. Make one the hex values 0 - F. Make the other the octal equivalents. See if that doesn't give a hint.

Another hint - try converting both to binary.
 
Top