Uses crt;
var
a:array [1..5] of integer;
i,m,n:integer;
f,g:Text;
BEGIN
clrscr; Write('m,n = ');
Read (m,n);
randomize;
Assign(f,'f.txt');
rewrite(f); //в фаил
for i:=1 to 5 do begin
a[i]:=random(10);
write(f,a[i]:2);
end;
Close(f);
Assign(g,'g.txt');
Rewrite(g); //в фаил
for i:=1 to 5 do
if ((a[i] mod m) = 0) and ((a[i] mod n) <> 0) then Write(g,a[i]:2);
Close(g);
END.
abc pascal