% Better mean program % Initialize data: clear, clc STUDENTS = input('Enter number of students: '); grade = -1; % current grade entered so far total = 0; % total of all grades so far % For each student, find the current grade and % add to total: for count = 1:STUDENTS grade = input('Enter a grade: '); total = total + grade; end % Report result: disp(['Mean grade: ',num2str(total/STUDENTS)]);