import java.util.Scanner;

/**
 * Demonstration of a solution to the N choose K problem (binomial coefficients).
 * <p>
      ( n )   ( n-1 )   ( n-1 )
      (   ) = (     ) + (     ) for 1 <= k <= n - 1
      ( k )   ( k-1 )   (  k  )

      ( n )   ( n )
      (   ) = (   ) = 1  for n >= 0 			   
      ( 0 )   ( n )
 * </p>
 * @author Hyrum D. Carroll
 * @version 0.2 (May 4, 2020)
 */
public class NChooseK{

    /**
     * Recursive solution to N choose K
     * @param n N
     * @param k K
     * @return The result of n choose k
    */
    public static int nChooseK( int n, int k ){
        int result = 0;








        System.out.println( "nChooseK( " + n + ", " + k + ") returning "+ result);
        return result;

    }

    public static void main( String[] args ){
        Scanner stdinScanner = new Scanner( System.in );
        int n = 0;
        int k = 0;

        System.out.print( "Please enter n: " );
        n = stdinScanner.nextInt();

        System.out.print( "Please enter k: " );
        k = stdinScanner.nextInt();

        // check arguments
        if( k < 0 || k > n || n < 0 ){
            System.out.println("Invalid arguments: n: " + n + ", k: " + k);
            return;
        }

        System.out.println( n + " choose " + k + " = " + nChooseK( n, k ));
    }
}