function found = vectorQuery(v,n,r)
% found is 1 if the number r appears in the first n cells of vector v.
% Otherwise found is 0.  n<=length(v).

found= 0;  % r hasn't been found yet
k= 1;      % index position being evaluated 
while(k<=n && ~found)
    if (v(k)==r) 
        found= 1;  %r  has been found at position 1
    end
    k= k+1;
end

    