Home / Questions / Convert the following while loop to the corresponding for loop: int m = 5, n = 10; while (n>=1) { System.out.println(m*n); n--; }
Explanatory Question

Convert the following while loop to the corresponding for loop:

int m = 5, n = 10;
while (n>=1)
{
    System.out.println(m*n);
    n--;
}

👁 60 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation


int m = 5;
for (int n = 10; n >= 1; n--) {
    System.out.println(m*n);
}