public class NestedLoops { public static void main(String[] args) { for (int line = 1; line <= 5; line++) { // vertical loop // dots for (int j = 1; j <= -1 * line + 5; j++) { System.out.print("."); } // number System.out.print(line); // dots for (int j = 1; j <= line - 1; j++) { System.out.print("."); } System.out.println(); } /* // some number of dots for (int j = 1; j <= -1 * line + 5; j++) { System.out.print("."); } // a number System.out.println(line); } /* for (int y = 1; y <= 2; y++) { for (int x = 1; x <= 3; x++) { System.out.println(x + ", " + y); } } for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 5; j++) { System.out.print((i * j) + " "); } System.out.println(); // to end the line } */ } }