Advertisement
LOVEGUN

Permutation Matrice

Apr 14th, 2021
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.69 KB | None | 0 0
  1. Program Matrice ;
  2. Uses Wincrt ;
  3. Type
  4.   mat = Array[1..5,1..5] Of Integer ;
  5. Var
  6.   t: mat ;
  7.   n: Integer ;
  8.  
  9. Procedure saisie(Var n:Integer ;Var t:mat);
  10. Var
  11.   i,j: Integer ;
  12. Begin
  13.     readln (n);
  14.     For i:=1 To n Do
  15.     For j:=1 To n Do
  16.       Begin
  17.         Writeln('t[',i,' ',j,']');
  18.         Readln (t[i,j]) ;
  19.       End ;
  20. End;
  21.  
  22. Procedure permute(n:Integer ; Var t:mat);
  23. Var
  24.   i,j,aux: Integer ;
  25. Begin
  26.   j := n ;
  27.   For i:=1 To n Do
  28.     Begin
  29.       aux := t[i,i];
  30.       t[i,i] := t[i,j] ;
  31.       t[i,n] := aux ;
  32.       j := j-1 ;
  33.     End;
  34.   For i:=1 To n Do
  35.     Begin
  36.       For j:=1 To n Do
  37.         Writeln(t[i,j],' ');
  38.     End ;
  39. End;
  40. Begin
  41.   saisie(n,t);
  42.   permute(n,t);
  43. End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement