const n = 20; var a:array[1..n] of integer; i, j:integer; check:boolean; begin for i := 1 to n do begin repeat a[i] := random(21); check := true; for j := 1 to i - 1 do if a[i] = a[j] then begin check := false; break; end; until check; write(a[i], ' '); end; writeln; end.
Answers & Comments
const
n = 20;
var
a:array[1..n] of integer;
i, j:integer;
check:boolean;
begin
for i := 1 to n do
begin
repeat
a[i] := random(21);
check := true;
for j := 1 to i - 1 do
if a[i] = a[j] then
begin
check := false;
break;
end;
until check;
write(a[i], ' ');
end;
writeln;
end.