Create and Read Matrix

Jx_Man 0 Tallied Votes 449 Views Share

Simple code for matrix with pascal.

--Jery--

program ExampleArr;         

 uses crt;               

 const ArrSize = 5;       
 
 type Tabel = array[1..ArrSize,1..ArrSize] of integer; 

 var Matrix : Tabel; 

 procedure READ_MATRIX (var Mat : Tabel; N : integer);
 var I, J : integer;  

 begin               
   for I := 1 to N do
     for J := 1 to N do
       read(Mat[I,J])
 end;                

 procedure PRINT_MATRIX (Mat : Tabel; N : integer);
 var I, J : integer;  

 begin               
   for I := 1 to N do
     begin
       for J := 1 to N do
         write(Mat[I,J]:8);
       writeln;
     end;
 end;                

 begin               
    READ_MATRIX(Matrix, ArrSize);
    PRINT_MATRIX(Matrix, ArrSize)
 end.