Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program app1;
- Uses Wincrt;
- Type
- tab = Array [1..20,1..20] Of Integer;
- Var
- t: tab;
- n: Integer;
- Function Somme_mat (t:tab;n:Integer): Integer;
- Var
- i,j,s: Integer;
- Begin
- s := 0;
- For i:=1 To n Do
- For j:=1 To n Do
- s:=s+t[i,j];
- Somme_mat:=s;
- End;
- Procedure traitement (Var t:tab;Var n:Integer);
- Var
- i,j: Integer;
- Begin
- Repeat
- Write('Saisir N: ');
- Readln (n);
- Until (4<=n) And (n<=20);
- Randomize;
- For i:=1 To n Do
- For j:=1 To n Do
- t[i,j] := Random(20);
- ClrScr;
- writeln ('La Matrice: ');
- For i:=1 To n Do
- Begin
- Writeln;
- For j:=1 To n Do
- Write (t[i,j],' | ');
- End;
- writeln;writeln;
- writeln ('La Somme: ');
- writeln;
- writeln (Somme_mat(t,n));
- End;
- Begin
- traitement (t,n);
- End.
Advertisement
Add Comment
Please, Sign In to add comment