%-------------------------------------------------------------------------------
% lecture8d
%-------------------------------------------------------------------------------
  clear
% more on
  more off
  clc
  echo on
% echo off
%-------------------------------------------------------------------------------
% accumulation

% set up input
g = input('enter grade: ')
sum = 0 % sum so far
n=0  % count of grades so far

% sum and count input grades
while g > -eps
 sum = sum + g
 n = n+1 
 g = input('enter grade: ')
end
if n > 0
 sum
 count
 average = sum/n
else
 disp(['no grades entered!'])
end
% 
