Acasa Tehnologie Comparare 2 vectori

Comparare 2 vectori

by Dragos Schiopu

>Sa se realizeze un program care afiseaza cate dintre componentele vectorului a sunt
strict mai mici decat componentele vectorului b.

program comparatie;
var a,b:array[1..50] of integer;
n1,n2,i,j,min,nr:integer;
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;
min:=b[j];
for j:=2 to n2 do begin
if b[j]<min then min:= b[j];
end;
for i:=2 to n1 do
if a[i]<min then begin
write(a[i], ' ');
nr:=nr+1;
end;
writeln;
write('nr=',nr);
readln;
end.
{PascalZone.uv.ro}

s-ar putea sa-ti placa