% An example of for loop
% sums the elements of a vector
% Minas Spetsakis, Mar. 2016

sz=10000;
A=rand(1,sz);
fprintf('The sum of A is %5.2f\n',sum(A));
mysum=0;
for i=1:sz
    mysum=mysum+A(i);
end;
fprintf('mysum is %5.2f\n',mysum);
