Example 2

Write the code for the following output:

12 34 5 6 7 8 9 10

As you can see, the output used in this example is the reverse of the output from first example: 

int k=1;for(int i=1;i<5;i++)  // (outer for loop) it will loop for 4 times     {         //System.out.println("outer loop started");         for(int j=1;j<=i;j++) //(inner for loop)         {             System.out.print("k");             System.out.print("\t");             k++;         }        System.out.println(" ");     }

Get Hands-On Automation Testing with Java for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.