1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
Program Bac3;
Uses wincrt;
Type
Tab=array [1..100] of integer;
Var
T1,T2:tab;
N,m,p,l:integer;
{************ Procédure Saisir ****************}
Procedure saisir (Var T1,T2 : Tab; n,m,p:integer);
var
i,j:integer;
begin
repeat
writeln('donner un entier n:');
readln(n);
writeln('donner un entier m: ');
readln(m);
until
(n>0) and (m>0);
repeat
for i:=1 to n do
begin
writeln('T1[',i,']=');
readln(T1[i]);
end;
for j:=1 to m do
begin
writeln('T2(',i,']=');
readln(T2[i]);
end;
repeat
writeln('donner un indice p: ');
readln(p);
until (p in [1..n]);
end;
{**************procédure division **************}
procedure division (Var T1,T2,T3:Tab,L,p:integer);
Var
a,i:integer;
Begin
L:=0;
a:=T1[p]
for i:= 1 to n do
begin
If (a mod T2[i]=0) then L:=L+1
for j:=1 to i do
T3[j]:=T2[i];
end;
if T3[j]<>0 then writeln (T3[j]);
end;
{*************** Programme Principal *************}
Begin
Saisir(T1,T2,N,M,P);
Division(T1,T2,T3,L,P)
end. |
Partager