Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (cavazos_899579):

I need help here.So I need to complete GettingIndividualDigits assignment and need some help to get my code to work. Here is my code: public class GettingIndividualDigits { public static void main( String[] args ) { int sum; for ( int dn1 = 10 ; dn1<= 99 ; dn1++ ) { for ( int dn2 = 1 ; dn2<= 9 ; dn2++ ) { // two loops, one for the tens place, and one for the ones place // CREATE dn1 OUT OF dn2 and dn3 System.out.println(dn1 + ", " + dn2 + "+" + dn3 + " = " + sum); } } } } } So I need to make two loops one for tens and one for ones and need~

OpenStudy (sparrow2):

what is the question?

OpenStudy (onepieceftw):

This is a nested loops question? The inside loop turns over faster so the ones place will be on the inside. Every time it comes to 9 the tens place will be incremented.

OpenStudy (rsmith6559):

If you're looking to split a number like 123 into 1, 2 and 3, that's a recursive problem, not one that uses loops.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!