1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Binary to Octal Digit quiz

Discussion in 'C' started by imported_jitendra kumar, Aug 26, 2011.

  1. imported_jitendra kumar

    imported_jitendra kumar New Member

    Joined:
    Aug 4, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Consider an n bit binary number. If the number is to be encoded in Octal, how many Octal digits would be required approximately?



    if u say n/3 then u r r* bt will get half marks only.
    Right answer is: Ceil(n/3)
    tell me why it is so.
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Please don't jump into any thread with your questions.

    If you don't have the number of binary digits divisible by 3 then you may need an extra octal digit to convert the binary number into octal
     
  3. gpk kishore

    gpk kishore New Member

    Joined:
    Jun 30, 2011
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    ceil function is nothing but it will round of to next high digit
    for example
    if u consider 4 bit number as 1001
    then 4/3 results in 1.3
    but ceil(n/3) =ceil(1.3)=2
    so oct representation of 1001=21(which has 2 digits)
     
  4. vinay singh

    vinay singh New Member

    Joined:
    Nov 6, 2011
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    namune ji when u take it as integer u need not to worry about decimals and u no need to use ceil function.got it
     
  5. vinay singh

    vinay singh New Member

    Joined:
    Nov 6, 2011
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    because ceil convert any floating point value to the next nearer integer:pimp:
     

Share This Page