I'm trying to fill an array with different numbers from 1000 to 9999. My problem is that my code is filling the array with the same number, here is my approach :
repeat
write('Enter an Integer from 5 to 20: '); readln(n)
until (n in [5..20]);
for i:=1 to n do
begin
T[i]:=random(9000)+1000; // 1000 to 9999
randomize
end;
writeln('___________________________________');
for i:=1 to n do
write(T[i], ' | ' );
writeln;
writeln('___________________________________');
Aucun commentaire:
Enregistrer un commentaire