Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Whileloop
- {
- public static void main (String args[])
- {
- int i = 1;
- while (i <= 4)
- {
- System.out.print("n");
- int j = 1;
- while (j <= i)
- {
- System.out.print(j);
- j++;
- }
- i++;
- }
- }
- }
- do{
- //do here
- }while(booleanExpression);
- class Tester
- {
- public static void main (String args[]){
- int i=1;
- do{ //block started with out checking condition
- System.out.print("n");
- int j=1;
- do { //inner loop starts
- System.out.print(j);
- j++;
- }while(j<=i); //condition check for inner loop
- i++;
- }while(i<=4); //condition check for outer loop
- }
- }
- int i=1;
- do {
- System.out.print("n");
- int j=1;
- do {
- System.out.print(j);
- j++;
- } while (j<=i);
- i++;
- } while(i <= 4);
- }
- while(condition)
- {
- //code
- }
- do
- {
- //code
- }while(condition);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement