Results 1 to 2 of 2
  1. #1
    andrew777 is offline Member
    Join Date
    Mar 2008
    Rep Power

    Default Help With Recursion

    Hi there,
    Im trying to write a method that takes in an int, and counts all the binary numbers up to that length, and prints them one by one. For example, 3 would give:


    And have come up with something really messy with a whole lot of while loops that doesnt quite work.

    I know there must be a simpler way to do it recursively but i cant quite wrap my head around how. Can anyone help?

    Thanks a lot

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    NewEngland, US
    Rep Power


    Let's see your code. I'm particularly interested in seeing the printing function for outputting binary numbers where from we can then begin to think about making it recursive.

    Please post the whole code and be sure to use surrounding [ code] tags.

    Oh, and welcome to the Java Forums!
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

Similar Threads

  1. recursion
    By kdeighan in forum New To Java
    Replies: 3
    Last Post: 01-25-2008, 10:48 PM
  2. Recursion
    By bozovilla in forum Advanced Java
    Replies: 3
    Last Post: 01-07-2008, 05:53 PM
  3. recursion
    By ravian in forum New To Java
    Replies: 2
    Last Post: 12-03-2007, 06:15 PM
  4. Help with recursion
    By scts102 in forum New To Java
    Replies: 1
    Last Post: 11-19-2007, 11:07 PM
  5. Recursion in java
    By lenny in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 06:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts