%A= ceil(10*rand(1,20));     
n=length(A);  %p29_maxwhile.m
maxindex=1;
maxval  =A(1);
ii=2;
while (ii <=n) 
  if A(ii) > maxval
    maxval=A(ii);
    maxindex=ii;
  end
  ii=ii+1;
end
maxval, maxindex
