343,106 views
24 votes
24 votes
7. Rewrite this "for" loop into a while loop:

for (int i = 0; i < 6; i = (i + 2)/2) {
System.out.print(i + " ");
}
+

User Oskarkv
by
2.8k points

1 Answer

12 votes
12 votes

Answer:

int i = 0;

while (i<6) {

System.out.print(i + " ");

i = (i+2)/2;

}

Step-by-step explanation:

User Domen Vrankar
by
2.9k points