n = input('Enter a positive integer '); err = 0; if n ~= abs(round(n)) % What is the purpose of this if-else structure? err = 1; else intsum = 0; for i=1:n intsum = intsum + i; end % This ends the for loop end % This ends the if-else structure if err disp('You must enter a positive integer.') else fprintf('The sum of the integers from 1 to %i is %i\n',n,intsum) end