DoWhile


public class dowhileconcepts {


public static void main(String[] args) {
int i=1;
do
{
System.out.println(i);//first print i =1
i++;                            //then increment
}while(i<=10);                  //checking for condition. loop continue until condition fails.
}
}

Output:

1
2
3
4
5
6
7
8
9
10

No comments:

Post a Comment