+ 1
Loop
When looping I understand how to loop eg: 1 2 3 4 5 Using system.out.println and system.out.print process them horizontally. Let’s say I wanted to place 5 numbers per row till 25 how would I go upon so? Egx; 01234 56789
2 Respostas
+ 1
if you dont mind me asking, for (int j=i; j<i+5; ++j) is essentially what tells the program to group itself in 5 per line? or vice versa ?
+ 1
In general:
int columns = 5;
int rows = 10;
for (int i=0; i<rows; i++) {
for (int j=0; j<columns; j++)
System.out.print(j+i*columns);
System.out.println();
}