% Compute a sum using a for loop
% with alternative loop variable
% Minas Spetsakis, Oct. 2017

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