Java While Loop
Java While Loop
While Loop
Syntax
do {
// code block to be executed
}
while (condition);
Example
Output:
int i = 0;
do {
0
1
System.out.println(i);
2
i++;
3
}
4
while (i < 5);
Let’s try this
• Print a multiples of 5 using java
Leaning task 3.1
• Write a program in Java that allows user to input a positive
integer and display the multiples of a given integer.