I am currently in a java class learning about all types of loops, and am stuck on a question specifically on do-while loops. The question asks that we create a do-while loop that counts 1 to 30, with the counting jumping to the next line after 10 integers, for example:
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
I have my loop started, and I can have it print values one through thirty, but I am not sure how to make it skip a line every 10 integers. Here is my current code:
int q = 0;
do
{
q=q+1;
System.out.print(q+" ");
}
while (q<30);
System.out.println();