class PascalsTriangle
{
  public static void main( String[] args )
  {
    int[][] triangle = new int[7][];

    for ( int row = 0; row < triangle.length; row++ ) // All rows
    {
      triangle[row] = new int[row + 1];               // New column of len i+1

      for ( int col = 0; col <= row; col++ )          // Columns
      {
        if ( (col == 0) || (col == row) )
           triangle[row][col] = 1;                    // Borders on 1
        else
           triangle[row][col] = triangle[row - 1][col - 1] + triangle[row - 1][col];

        System.out.printf( "%2d ", triangle[row][col] );
      }

      System.out.println();
    }
  }
}
