Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program exercice6;
- Uses Wincrt;
- Type
- mat = Array [1..99,1..99] Of Integer;
- Var
- m,n: Integer;
- a: mat;
- Procedure remplir (Var a:mat;Var m,n:Integer);
- Var
- i,j: Integer;
- Begin
- Repeat
- Writeln ('Saisir le nombre de ligne');
- Readln (m);
- Writeln ('Saisir le nombre de collone');
- Readln (n);
- Until (m>0) And (n>0) And (m<=8) And (n<=10);
- For i:=1 To m Do
- For j:=1 To n Do
- Begin
- Writeln ('A[',i,',',j,'] : ');
- Readln (a[i,j]);
- End;
- End;
- Procedure somme (a:mat;i,n:Integer;Var s:Integer;Var chs:String);
- Var
- j: Integer;
- x: String;
- Begin
- s := 0;
- chs := '';
- For j:=1 To n Do
- Begin
- s := s+a[i,j];
- Str (a[i,j],x);
- chs := chs+ x+'+';
- End;
- Delete (chs,Length(chs),1);
- End;
- Procedure produit (a:mat;i,m:Integer;Var p:Integer;Var chp:String);
- Var
- j: Integer;
- x: String;
- Begin
- p := 1;
- chp := '';
- For j:=1 To m Do
- Begin
- p := p*a[j,i];
- Str (a[j,i],x);
- chp := chp+ x+'*';
- End;
- Delete (chp,Length(chp),1);
- End;
- Procedure affiche (a:mat;m,n:Integer);
- Var
- p,i,s,j: Integer;
- chp,chs: String;
- Begin
- Writeln;
- For i:=1 To m Do
- For j:=1 To n Do
- Begin
- somme (a,i,n,s,chs);
- produit (a,j,m,p,chp);
- If s=p Then
- Writeln ('A[',i,',',j,'] : ', a[i,j],' (car ',chs,'=',chp,')');
- End;
- End;
- Begin
- remplir (a,m,n);
- affiche (a,m,n);
- End.
Add Comment
Please, Sign In to add comment