//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Example 4.11 on page 78
//  Recursive Implementation of the Binomial Coefficient Function


public class Ex0411
{ public static int c(int n, int k)
  { if (k==0 || k==n) return 1;    // basis
    return c(n-1,k-1) + c(n-1,k);  // recursion
  }

  public static void main(String[] args)
  { for (int n=0; n<4; n++)
    { for ( int k=0 ; k <= n; k++)
        System.out.print("\t" + c(n,k));
      System.out.println();
    }
  }
}
