
public class NestedLoops {

	public static void main(String[] args) {
		final int MAX = 10;
		//nested loops - loop within a loop
		
		//for each line (row)
		for(int row = 1; row <= MAX; row++) {
			//write one line (row)
			//each column
			for(int col = 1; col <= MAX; col++) {
				System.out.printf("(%3d, %3d ) ", row, col);
			}
			System.out.println();  //end with a new line
		}
		System.out.println("-------------------------------------------");
		
		
		//for each line (row)
		for(int row = 1; row <= MAX; row++) {
			//write one line (row)
			//each column up to the row number
			for(int col = 1; col <= row; col++) {
				System.out.printf("(%3d, %3d ) ", row, col);
			}
			System.out.println();  //end with a new line
		}
		System.out.println("-------------------------------------------");
		
		//make the number of columns decrease from MAX in row 1
		
		//for each line (row)
		for(int row = 1; row <= MAX; row++) {
			//write one line (row)
			//each column up to the row number
			for(int col = 1; col <= MAX + 1 - row; col++) {
				System.out.printf("(%3d, %3d ) ", row, col);
			}
			System.out.println();  //end with a new line
		}
		System.out.println("-------------------------------------------");
		
		// print out a multiplication table
		
		//for each row
		for(int row = 1; row <= MAX; row++) {
			//body of the row for loop prints one row
			//row header
			System.out.printf("%3d|", row);
			//for each column
			for(int col = 1; col <= MAX; col++) {
				//print row * col
				System.out.printf("%3d ", row*col);
			}
			System.out.println();
		} 
		
		
	}

}
