Results 1 to 2 of 2
Thread: Help With Recursion
- 03-29-2008, 08:29 AM #1Member
- Join Date
- Mar 2008
- Rep Power
Help With Recursion
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
- 03-29-2008, 12:51 PM #2
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!
- By kdeighan in forum New To JavaReplies: 3Last Post: 01-25-2008, 09:48 PM
- By bozovilla in forum Advanced JavaReplies: 3Last Post: 01-07-2008, 04:53 PM
- By ravian in forum New To JavaReplies: 2Last Post: 12-03-2007, 05:15 PM
- By scts102 in forum New To JavaReplies: 1Last Post: 11-19-2007, 10:07 PM
- By lenny in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 06:23 AM