Hello all -- found myself stuck on a certain bit of code dealing with a number pattern I put together. I've written out most of the code, but I'm stuck in 2 areas - thought maybe someone could help shed some light. It seems like it would be very simple, but I just can't get it to work right yet, with whatever I code in.
Here's the output I'm trying to achieve:
12345
23451
34512
45123
51234
This is what I've written out so far (stuck spots marked with "?"):
public class NumPattern {
public static void main (String[] args) {
for (int i=1; i <= 5; i++) {
int next = i;
for (?) {
System.out.print (next++);
if (next > 5)
next = 1;
}
System.out.print(?);
}
}
}
Many thanks in advance!