Дан одномерный массив из чисел. найти в нем наиболее встречающуюся цифру и посчитать сколько раз она встречается — Pascal(Паскаль)

uses crt;
var
a:array[1..100]of integer;
i,j,n,ch,kol:integer;
begin clrscr;
randomize;
write('n=');
read(n);
for i:=1 to n do
begin
  a[i]:=random(20);
  write(a[i],'  ');
end;
writeln;
kol:=0;
for j:=1 to n do
begin
  kol:=0;
  ch:=a[j];
  for i:=1 to n do
  if a[i]=ch then inc(kol);
  writeln('element ',ch,' vstrechaetsya ',kol,' raz');
end;
readkey;
end.

Leave a Comment

42 − 40 =