import java.util.*;

public class mult2 {
	
	public static void main(String[] args) {
		
		int[][] table = new int[20][15];
		
		// Fills multiplication table.
		for (int row=0; row<table.length; row++) {
			for (int col=0; col<table[row].length; col++) {
				table[row][col] = (row+1)*(col+1);
			}
		}
		
		// Prints the multiplication table.
		for (int row=0; row<table.length; row++) {
			for (int col=0; col<table[row].length; col++) {
				System.out.print(table[row][col]+"\t");
			}
			System.out.println();
		}
		
		Scanner stdin = new Scanner(System.in);
		System.out.println("How many rows of pascal's triangle do you want?");
		int n = stdin.nextInt();
		
		int[][] pascaltri = new int[n+1][n+1];
		
		// Initializes the left side of the triangle
		for (int i=0; i<=n; i++)
			pascaltri[i][0] = 1;
		
		// Initialize right side
		for (int i=0; i<=n; i++)
			pascaltri[i][i] = 1;
			
		// Fill in the rest of the table.
		for (int row=2; row<=n; row++) {
			for (int col=1; col<row; col++) {
				pascaltri[row][col] = pascaltri[row-1][col-1] + pascaltri[row-1][col];
			}
		}
		
		// Print out the table.
		for (int row=0; row<=n; row++) {
			
			// Print tabs
			for (int col=0; col<(n-row)/2; col++)
				System.out.print("\t");
				
			// Try to make the odd rows work...
			if (row%2 == 1)
				System.out.print("  ");
				
			for (int col=0; col<=row; col++) {
				System.out.print(pascaltri[row][col] + "\t"); 
			}
			System.out.println();
		}
		
		
	}
	
}