
-----------------------------------
CluelessWithJava
Fri Oct 23, 2009 1:01 am

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.


*Displays digits of user inputted integer seperately. 
*/

   import java.util.Scanner;

    public class DigitsDisplay
   {
       public static void main (String

Thanks for your time.

-----------------------------------
Zren
Fri Oct 23, 2009 1:34 am

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.

-----------------------------------
CluelessWithJava
Fri Oct 23, 2009 7:52 pm

Re: Help with loop/if clause
-----------------------------------
I seemed to have found a simpler way to do it from my friend =S

 *Displays digits of user inputted integer seperately. 
*/

   import java.util.Scanner;

    public class DigitsDisplay
   {
       public static void main (String

-----------------------------------
Shah-Cuber
Fri Oct 23, 2009 8:17 pm

Re: Help with loop/if clause
-----------------------------------
Your welcome :)
