249
>Intersectia a doua multimi a si b.
program intescectie;
var a,b:array[1..50] of integer;
n1,n2,i,j:integer;
ok:boolean;
BEGIN
WRITE('N1='); readln(n1);
for i:=1 to n1 do begin
write('a[',i,']=');readln(a[i]);
end;
for i:=1 to n1 do write(a[i], ' ');
writeln;
WRITE('N2='); readln(n2);
for j:=1 to n2 do begin
write('b[',j,']=');readln(b[j]);
end;
for j:=1 to n2 do write(b[j], ' ');
writeln;
for i:= 1 to n1 do begin
ok:=false;
for j:=1 to n2 do begin
if a[i]=b[j]then ok:=true;
end;
end;
if ok then write(a[i], ' ')
else write('nu exista');
readln;
end.
{PascalZone.uv.ro}