% hw021.m
% John Burkardt
% Combinatorial coefficient C(N,K).
%
n = input ( '  Enter value of N: ' );
k = input ( '  Enter value of K: ' );

cnk = 1;
for i = 1 : k
  cnk = cnk * ( n + 1 - i ) / i;
end

fprintf ( '  C(%d,%d) = %d\n', n, k, cnk );

