% nchoosek_stepping.m
%  Compute n-choose-k.
%
n = input ( 'Enter the value of N: ' );
k = input ( 'Enter the value of K: ' );

for i = 0 : k

  if ( i == 0 )
    value = 1;
  else
    value = value * ( n + 1 - i ) / i;
  end

end

fprintf ( ' %d-Choose-%d = %d\n', n, k, value );

