230
>
program intersectie; 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], ' '); for i:=1 to n1 do begin ok:=false; for j:=1 to n2 do if b[j]=a[i] then ok:= true; end; writeln; if ok then writeln('intersec=',a[i]); readln; end. {by Matei Alexandru PascalZone.evonet.ro}
0 comentarii