java - Outputting a group ring values using two for loops -
i'm learning java , seem weak in knowledge of loops.
i supposed call printsquare(1, 5);
. output want is:
12345 23451 34512 45123 51234
i tried out:
public void printsquare(int min,int max){ for(int i=min;i<=max;i++){ for(int j=i;j<=max;j++){ system.out.print(j); } system.out.println(); } }
which gives me:
12345 2345 345 45 5
i tried inserting 2 more loops not seem work.
i appreciate if don't give me full answer, because not way learn. prefer clues on how accomplish this.
you should add 1 more loop nested i
loop, outside j
loop.
it should min
i-1
.
Comments
Post a Comment