👤

sa se compuna un program care afla daca exista un vector cu 5 componente vreun element cu valoarea caruia este 0 aratindui pe ce loc sta .

Răspuns :

Program Tema;

Type vector:array[1...5] of integer;
Var v:vector;
      i,gasit:integer;
begin
gasit:=-1;
writeln('Introduceti cele 5 elemente ale vectorului: ');
for i=1 to 5 do
begin
read(v[i])
if (v[i]=0) then
begin
gasit:=i;
break;
end;
end;

if(gasit=-1) then
writeln('Nici un element al matricei nu este egal cu 0');
else
writeln('Elementul ',gasit,' al matricei este egal cu 0');

end.