Université A.
Mira de Béjaia Le 03/11/2020
Faculté de Technologie
Département de Technologie solution de l’examen –Informatique 2
Exercice 1 :(06 points)
program exo1;
uses wincrt;
var T:array[1..100] of integer; 0,5 pts
i,n,valeur, compt:integer; 0,5 pts
begin
read(n); 0,5 pts
for i:=1 to n do 0,5pts
read(T[i]);
read(valeur); 0,5 pts
compt:=0; 0,5 pts
for i:=1 to n do 0,5 pts
if (T[i] mod valeur = 0 ) then 1 pts
compt:=compt +1; 1 pts
writeln(compt); 0,5 pts
end.
Exercice 2 :( 07 points)
1)
program recherche_toutes_occurences ;
Var T : array [1..100] of real;
N,i : integer ; 0,5 pts
X : real ;
Existe : boolean ; 0,5 pts
begin
read(N) ;
for i:= 1 to N do 0,5 pts
read( T[i] ) ;
writeln( ' entrer la valeur de l’’élément à chercher : ' ) ;
read(X) ; 0,5 pts
Existe :=false;
for i := 1 to N do 0,5 pts
if T[i] = X then
begin
1 pts Existe:= true;
writeln( ' l’’élément à chercher apparait à la position : ', i ) ;
end;
if Existe = False then
writeln( ' l’’élément n’’apparait pas dans ce tableau ' ) ; 0,5 pts
end.
Université A. Mira de Béjaia Le 03/11/2020
Faculté de Technologie
Département de Technologie solution de l’examen –Informatique 2
2)
Algorithme recherche_première_occurence;
Var T : tableau [1..100] de réels ;
P, N,i : entiers ;
X : réel ;
Existe : booléen ;
Début
lire(N) ;
Pour i 1 à N Faire
lire( T[i] ) ;
Fin pour i
Ecrire( ‘ entrer la valeur de l’’élément à chercher : ’ ) ;
Lire(X) ;
Existe Faux ;
i 1 ; 0,5 pts
tant-que (i<=N) et (Existe=Faux) Faire 1 pts
Si T[i] = X alors
Existe Vrai ;
P i ;
Sinon
ii+1 ; 0,5 pts
Fin si
Fin tant-que
Si Existe = vrai alors
Ecrire(‘la première occurrence de l’élément dans ce tableau est :’,P) ; 0,5 pts
Sinon
Ecrire(‘l’’élément n’’apparait pas dans ce tableau ‘) ; 0,5 pts
Finsi
Fin.
Exercice 3 :( 07 points)
1) 2)
program exo3_1; program exo3_2;
uses wincrt; uses wincrt;
var a:array[1.. 10,1..10] of integer; var a:array[1.. 10,1..10] of integer;
vect:array[1..10] of integer; 0,5 pts vect:array[1..10] of integer;
i,j,n,k:integer; i,j,n,k:integer;
begin begin
read(n); read(n);
for i:=1 to n do for i:=1 to n do
for j:=1 to n do for j:=1 to n do
read(A[i,j]); read(A[i,j]);
for i:= 1 to n do for j:= 1 to n do 0,5 pts
begin begin
vect[i]:=0; 1 pts vect[j]:=0; 0,5 pts
for j:= 1 to n do for i:= 1 to n do 0,5 pts
if a[i,j]>a[i,i] then if a[i,j]>a[j,j] then 0,5 pts
vect[i]:=vect[i]+1; 1,5 pts vect[j]:=vect[j]+1; 1 pts
end; end;
for i:=1 to n do for i:=1 to n do
write(vect[i]); 1 pts write(vect[i]);
end. end.