На языке Паскаль:
const
n = 10;
var
i, a, max, count: integer;
begin
max = -32768 ;
count := 0;
writeln('МАссив:');
for i := 1 to n do
read(a);
if a > max
then
max := a;
count := 1;
end;
else
if a = max
inc(count)
writeln('Count max = ', count);
end.
var a := ArrRandom(10, 1, 9);
a.Println;
Println('Кол-во чисел, равных max:',
a.FindAll(p -> p = a.Max).Count)
На языке Паскаль:
const
n = 10;
var
i, a, max, count: integer;
begin
max = -32768 ;
count := 0;
writeln('МАссив:');
for i := 1 to n do
begin
read(a);
if a > max
then
begin
max := a;
count := 1;
end;
else
if a = max
then
inc(count)
end;
writeln('Count max = ', count);
end.
begin
var a := ArrRandom(10, 1, 9);
a.Println;
Println('Кол-во чисел, равных max:',
a.FindAll(p -> p = a.Max).Count)
end.