Ответ:
program GradesFinder;
var
grades: array[Integer] of Integer;
gradesCounter: array[3..5] of Integer = (0,0,0);
gradesSum: Integer = 0;
mostCommonGradeCounter: Integer = 0;
mostCommonGrade: Integer = 0;
i: Integer;
begin
Randomize;
writeln('Оценки учеников:');
for i:=0 to 19 do
grades[i] := 3 + Random(3);
writeln(i+1,': ',grades[i]);
gradesCounter[grades[i]] := gradesCounter[grades[i]] + 1;
gradesSum := gradesSum + grades[i]
end;
writeln('Число отметок 5: ', gradesCounter[5]);
writeln('Средний бал: ', gradesSum/20:2:1);
write('Болше всего получено: ');
for i := 3 to 5 do
if mostCommonGradeCounter < gradesCounter[i] then
mostCommonGrade := i;
mostCommonGradeCounter := gradesCounter[i];
writeln(mostCommonGrade);
end.
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
program GradesFinder;
var
grades: array[Integer] of Integer;
gradesCounter: array[3..5] of Integer = (0,0,0);
gradesSum: Integer = 0;
mostCommonGradeCounter: Integer = 0;
mostCommonGrade: Integer = 0;
i: Integer;
begin
Randomize;
writeln('Оценки учеников:');
for i:=0 to 19 do
begin
grades[i] := 3 + Random(3);
writeln(i+1,': ',grades[i]);
gradesCounter[grades[i]] := gradesCounter[grades[i]] + 1;
gradesSum := gradesSum + grades[i]
end;
writeln('Число отметок 5: ', gradesCounter[5]);
writeln('Средний бал: ', gradesSum/20:2:1);
write('Болше всего получено: ');
for i := 3 to 5 do
if mostCommonGradeCounter < gradesCounter[i] then
begin
mostCommonGrade := i;
mostCommonGradeCounter := gradesCounter[i];
end;
writeln(mostCommonGrade);
end.
Объяснение: