% nchoosek_sum.m
%  Compute the sum of row N of Pascal's triangle.
%
n = input ( 'Enter the value of N: ' );
total = 0;

for k = 0 : n

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

  total = total + value;

end

fprintf ( 'Row %d sums to %d\n', n, total );
