Advertisements
Advertisements
Question
Rewrite the following do while program segment using for:
x = 10; y = 20;
do
{
x++;
y++;
}while (x<=20);
System.out.println(x*y);
Short Note
Solution
int x,y;
for(x=10, y=20; x<=20;x++,y++);
System.out.println(x*y);
shaalaa.com
Output Statement in Java Programming
Is there an error in this question or solution?