const
n=10;
var
a:array [1..n] of integer;
i,count,max:integer;
begin
randomize;
max:=-8; count:=1;
for i:=1 to n do
a[i]:=random(23)-7;
write(a[i]:4);
if a[i]=max then
inc(count)
else if a[i]>max then
count:=1;
max:=a[i];
end;
writeln;
writeln('Max: ', max);
write('Count: ',count);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const
n=10;
var
a:array [1..n] of integer;
i,count,max:integer;
begin
randomize;
max:=-8; count:=1;
for i:=1 to n do
begin
a[i]:=random(23)-7;
write(a[i]:4);
if a[i]=max then
inc(count)
else if a[i]>max then
begin
count:=1;
max:=a[i];
end;
end;
writeln;
writeln('Max: ', max);
write('Count: ',count);
end.