Pour i de 1 à p :
-Pour j de 1 à n :
-si Tableau [i,j] vaut x
--Alors trouvé vaut True
-fin boucle 2
fin boucle 1
Ca donne
Program ----;
uses wincrt;
Const n:=3; p:=4;
Var Tab:array[1..n,1..p]of integer;
i,j:integer;
trouve:boolean;
BEGIN
[Tab doit etre rempli avant]
x:=1; # exemple
trouve:=false
For i:=1 to n do
begin
For j:=1 to p do
begin
if Tab[i,j]=x
then trouve:=true;
end;
end;
If trouve=true
then writeln('x appartiens a la matrice');
END.
(Avec un doute sur les ' => " ? )
Attention, le tableau (la matrice) DOIT ETRE initialisé (rempli d'entiers dans le programme)
Contributeur CCM.
"Si vous savez, répondez a ce message, sinon, abstenez vous, merci !"