import java.util.*;
class loop
{
public static void main (String arg[])
{
Scanner in = new Scanner (System.in);
int a=10;
while (a<=20)
{
System.out.print ("\n\t a = "+a);
++a;
}
}
}
Remember, while a is less than or equal to 20 body of the loop will be executed. Once a equals to 21, loop will be broken and control goes to the next statement after that loop.
No comments:
Post a Comment