% Example of using a while loop as a sentinal
% Michael Haggerty for CISC105 - Class Example 10.10.2007

sum = 0;
val = 0;

while val ~= 'q'
   sum = sum + val;
   val = input('Enter a number (''q'' to quit): ');
end

fprintf('The sum of the numbers you entered is %f\n', sum);

   
