SOURCE FILE: nChooseA.cpp


/* This is a little program that exercises a RECURSIVE
   function that calculates N choose K. */

#include <iostream.h>

int chooseA (int N, int K)
{
  if ((N == 0) || (K == 0) || (K == N)) return 1;
  else return chooseA(N-1, K-1) + chooseA(N-1, K) ;
}

int main ()
{
  cout << "10 Choose 5 is: " << chooseA(10,5) << endl ;
  cout << "20 Choose 10 is: " << chooseA(20,10) << endl ;
  cout << "22 Choose 11 is: " << chooseA(22,11) << endl ;
  cout << "24 Choose 12 is: " << chooseA(24,12) << endl ;
  cout << "26 Choose 13 is: " << chooseA(26,13) << endl ;
  cout << "28 Choose 14 is: " << chooseA(28,14) << endl ;
  cout << "30 Choose 15 is: " << chooseA(30,15) << endl ;
  cout << "40 Choose 20 is: " << chooseA(40,20) << endl ;
  cout << "50 Choose 25 is: " << chooseA(50,25) << endl ;
  cout << "60 Choose 30 is: " << chooseA(60,30) << endl ;
  cout << "70 Choose 35 is: " << chooseA(70,35) << endl ;
  return 0 ;
}