octal to hexadecimal

Discussion in 'Homework Help' started by armic, Feb 2, 2009.

  1. armic

    Thread Starter New Member

    Feb 2, 2009
    2
    0
    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
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    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
     
  3. armic

    Thread Starter New Member

    Feb 2, 2009
    2
    0
    thx.
    and how to write a program to convert oct into hexa?
     
  4. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    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.
     
Loading...