Computer Applications

Rewrite the following program using do while loop:

class Test
{
public static void main(String args[])
{
int x,c; 
for(x=10,c=20;c>=10;c=c-2)
{
x++;
System.out.println(x);
} 
}
}

Java Iterative Stmts

ICSE 2009

97 Likes

Answer

class Test
{
public static void main(String args[])
{
int x=10, c=20; 
do {
x++;
System.out.println(x);
c=c-2;
} while (c>=10);
}
}

Answered By

66 Likes


Related Questions