Program n1; Uses Crt; var a: array[1..30] of integer; k,m,i,j,n: integer; begin for i:=1 to 30 do begin a[i]:=random(50)+50; write(a[i],' '); end; writeln; writeln('---'); k:=0; n:=1; for i:=1 to 30 do begin n:=0; m:=a[i]; for j:=1 to 30 do begin if (m=a[j]) and (i<>j) and (n<2) then begin k:=k+1; n:=n+1; end; end; end; writeln('Kol-vo chisel - ', k/2); end.
Uses Crt;
var a: array[1..30] of integer;
k,m,i,j,n: integer;
begin
for i:=1 to 30 do
begin
a[i]:=random(50)+50;
write(a[i],' ');
end;
writeln; writeln('---');
k:=0; n:=1;
for i:=1 to 30 do begin
n:=0; m:=a[i];
for j:=1 to 30 do begin
if (m=a[j]) and (i<>j) and (n<2) then begin
k:=k+1; n:=n+1;
end;
end;
end;
writeln('Kol-vo chisel - ', k/2);
end.
Вроде бы сделал так, как требовалось.