% nchoosek_max.m
%  Compute the maximum value on row N of Pascal's triangle.
%
n = input ( 'Enter the value of N: ' );

for k = 0 : n

  if ( k == 0 )
    value = 1;
    value_max = value;
  else
    value = value * ( n + 1 - k ) / k;
    value_max = max ( value_max, value );
  end

end

fprintf ( 'Maximum value observed = %d\n', value_max );
