Computer Science Canada Help with loop/if clause |
Author: | CluelessWithJava [ Fri Oct 23, 2009 1:01 am ] | ||
Post subject: | Help with loop/if clause | ||
I need a little help with my program. Basically, I want my program to output the digits of a user inputted integer on seperate lines (I.E the ones digit would be 0 1 1 1 0 for the integer 1110)The integer can go up to 1 billion and the digits must be checked starting from the 1 billionth point, But I also want the program to not output the zeros preceding the actual number (So for 111 it would output 1 1 1 not 0 0 0 0 0 0 0 1 1 1). I'm having a little trouble with the clause though that would remove the preceding zeros. I could appreciate any tips or help, my code with the clause is below.
Thanks for your time. |
Author: | Zren [ Fri Oct 23, 2009 1:34 am ] |
Post subject: | RE:Help with loop/if clause |
Wouldn't converting the number to a string, then printing out each character have been a simpler approach? Forgot this: while (zeros == false) Why not use an else statement instead of the !=0 condition? Not sure if that's all of it since I don't have Java set up at the mo. |
Author: | CluelessWithJava [ Fri Oct 23, 2009 7:52 pm ] | ||
Post subject: | Re: Help with loop/if clause | ||
I seemed to have found a simpler way to do it from my friend =S
|
Author: | Shah-Cuber [ Fri Oct 23, 2009 8:17 pm ] |
Post subject: | Re: Help with loop/if clause |
Your welcome |