% getMax: Determine the max of a positive sequence

% Written by Paul Chew for CS100M, Feb 2006

best = -1;
number = input('First number: ');
while number > 0
    best = max(best, number);
    number = input('Next number: ');
end
if best > -1
    fprintf('The max value was %d\n', best)
else
    disp('No max because no input')
end