English

Convert the following do...while loop to for loop: int x = - 10;do

Advertisements

Question

Convert the following do...while loop to for loop:

int x = - 10;
do

{x - -;
System.out.print(x);
}while(r >= 1);
Answer in Brief
Advertisements

Solution

Using for loop:

for(int x = 9; x >= 0; x--)
{
     System.out.print(x);
}
shaalaa.com
Introduction of Nested Loop
  Is there an error in this question or solution?
2022-2023 (March) Official
Advertisements
Share
Notifications



      Forgot password?
Use app×