Page 108 - 2617_JSSPS_C-7
P. 108
Start
Conditional False
Expression
True
Body of while loop
Stop
Flowchart of while loop
The syntax of the while loop is as follows:
while(< conditional expression >)
{
[statements]
[increment/decrement expression]
}
Program 9: Write a program to print the value of i from 1 to 10.
1 public class WhileLoop
2 {
3 public static void main(String args[])
4 {
5 int i = 1;
6 while (i <= 10)
7 {
8 System.out.println("The value of i is: " + i);
9 i++;
10 }
11 }
12 }
Premium Edition-VII
106

