Selasa, Januari 11, 2022

Program Pascal Menampilkan Bilangan Acak Secara Bergantian

var
a:set of 1..5; b:set of 1..5;
a1:integer; a2:array[1..5]of integer;
z,y,x:integer;

begin
a:=[1..5];
for x:=1 to 5 do
begin
randomize;
for a1 in a do
begin
z:=z+1;
a2[z]:=a1;
end;
y:=random(z)+1;
b:=[a2[y]]; write(a2[y]);
readln;

a:=a-b; z:=0;
end;
writeln('selesai');
readln;
end.

0 komentar: