Division by 3 using itoa()

Discussion in 'C' started by kens, Jul 17, 2007.

  1. kens

    kens New Member

    Joined:
    Jul 17, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    WAP to divide a number by 3 using itoa() and without using /,% and *.

    Please help me with this problem.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I could not understand your problem and as far as I know itoa() converts integer to character?
     
  3. kens

    kens New Member

    Joined:
    Jul 17, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Can iota() be used to convert a number in base 10 to one in base 3 and then, if we could remove the last digit of the answer, that is 12 will be 110, remove last 0 ,making it 11.
    Then, can we convert the result back to base 10 and display the answer?

    Am I thinking in the right direction? If yes, is there an easy way to convert from base 3 back to base 10?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice