Computer Science, asked by sjaitely, 5 months ago

Rewrite the following code using a do-while loop.

for(int i=10, j=20; j>=20; j -= 2, i++)
System.out.println("i = "+i);

Answers

Answered by babitaji2018
2

Explanation:

int i = 1;

while (i < 10)

if (i % 2 == 0)

System.out.println(i);

Answered by thewakebakecake
1

Answer:

public class answer {

public static void main(String[] args) {

 

 

 

 int i = 10;

 int j = 20;

 while (j>=20) {

  j -= 2;

  System.out.println("i = "+i);

  i++;

   

   

 

 }

}

}

Explanation: first, declare variables i and j and then create the while loop in which you need to do the operations and output. Done!

Similar questions