% for loop tutorial

% sum the #'s from 1 to 100 using a for loop

% sum = 0;
% for i=1:100
%     sum = sum + i; % update the sum
% end
% sum

j = 1; % initialize j
sum = 0; % init sum
while (j <= 100)
    sum = sum + j;
    j = j + 1; % update j 
end

sum