Código:
program Exercicio5;
var
Matr, same: array [1..5, 1..5] of real;
lin, col, linPesq, ColPesq:integer;
repete: boolean;
begin
randomize;
for lin:= 1 to 5 do
begin
writeln;
for col:= 1 to 5 do
begin
Matr[lin, col]:= random (1000);
same[lin,col]:= Matr[lin,col];
write(Matr[lin, col]:0:2, ' | ');
end;
end;
for LinPesq:= 1 to 5 do
begin
for ColPesq:= 1 to 5 do
begin
for lin:= 1 to 5 do
begin
for col:= 1 to 5 do
begin
if same[LinPesq,ColPesq] = Matr[lin, col] then
begin
if lin and col and LinPesq and ColPesq <> 1 then
begin
repete := true;
break;
end;
end;
end;
end;
end;
end;
writeln;
writeln;
if repete = true then
writeln('Ha elementos repetidos na matriz')
else
writeln('Nao ha elementos repetidos na matriz');
readln;
end.