SHARE
TWEET

Basic Matrix Pascal

SuperEPF Aug 14th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Matrice;
  2. const
  3. MAX = 100;
  4.  
  5. type matrica = array [1..MAX,1..MAX] of integer;
  6.  
  7. var
  8. n,m: integer;
  9. a:matrica;
  10.  
  11. procedure readmatrix(n:integer; m:integer; var a:matrica);
  12. var
  13. i,j:integer;
  14.  
  15. begin
  16. for i:=1 to n do
  17.     for j:=1 to m do
  18.         read(a[i,j]);
  19.  
  20. end;
  21. procedure printmatrix(n,m:integer; a:matrica);
  22. var
  23. i,j:integer;
  24.  
  25. begin
  26. for i:=1 to n do
  27. begin
  28.     for j:=1 to m do
  29.         write(a[i,j],' ');
  30.         writeln(' ');
  31. end;
  32. end;
  33.  
  34. procedure transpon(var n,m:integer;var a:matrica);
  35. var
  36. i,j,t:integer;
  37. o:matrica;
  38.  
  39. begin
  40. for i:=1 to n do
  41.  
  42.     for j:=1 to m do
  43.         o[j,i]:=a[i,j];
  44.      t:=m;
  45.      m:=n;
  46.      n:=t;
  47.    
  48.    a:=o;
  49.      
  50.  
  51.  
  52. end;
  53.  
  54. begin
  55. writeln('Uneti broj vrsta i kolona matrice: ' );
  56. read(n,m);
  57. readmatrix(n,m,a);
  58. printmatrix (n,m,a);
  59. transpon(n,m,a);
  60. writeln(' ');
  61. printmatrix (n,m,a);
  62.  
  63.  
  64. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top