Acasa Tehnologie Cautare element in vector

Cautare element in vector

by Dragos Schiopu

programare

>

program cautare;
var v:array[1..50]of integer;
    n,i,x:integer;
    ok:boolean;
begin
     write('n=');readln(n);
     for i:=1 to n do begin
         write('v[',i,']=');readln(v[i]);
         end;
     for i:=1 to n do write(v[i], ' ');
     writeln;
     write('x=');readln(x);
     ok:=false;
     for i:=1 to n do begin
         if v[i]=x then ok:=true;
         end;
     if ok then writeln('gasit')
        else writeln('nu gasit');
     readln;
end.
{by XmanZ PascalZone.evonet.ro}

s-ar putea sa-ti placa