Convert the following while loop to the corresponding for loop:

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

Views 10

Answer:


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

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.