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.
Объяснение:
using namespace std;
int main()
{
int a = 0, b = 0, c = 0;
int h = 0, g = 0, k = 0;
int j = 0, v = 0, l = 0;
cout << "a - chas" << "\n" << "b - minutes" << "\n" << "c - seconds" << "\n";
cin >> a >> b >> c;
cout << "h - chas" << "\n" << "g -minutes" << "\n" << "k - seconds" << "\n";
cin >> h >> g >> k;
j = ((a*60)*60)+(b*60)+c;
v = ((h*60)*60)+(g*60)+k;
l = v - j;
cout << l;
}
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.
Объяснение: