Posted by: different_planet September 17, 2006
Java help
Login in to Rate this Post:     0       ?        
initially, whether its Java or C, you can always loop to the length(number of digits) of the input number and increase the mod and division depth as you loop. or, if you have been into recursion, you may try this. public static void myMethod(int number) { if (number < 10) System.out.println(number); else { myMethod(number/10); System.out.println(number % 10); } } i have not tested this code though - i guess you get the logic.
Read Full Discussion Thread for this article