Pascal Program For Matrix Multiplication


Pascal program to multiply arrays A[i , j] and B[i, j] . Each element of the resulting matrix is multiplied by 1/4

Program begn;
Var
A, B, C, D : Array [1..2,1..2] of real;
I, j: integer;

Begin
  For i:= 1 to 2 do
    For j:= 1 to 2 do
      Begin
      Readln (A[i, j]);
      End;
  
  
Begin
  For i:= 1 to 2 do
    For j:= 1 to 2 do
      Readln (B[i, j]);
      End;
  
  
Begin
  For i:= 1 to 2 do
    For j:= 1 to 2 do
      C[i, j]:= A[i, j] * B[i, j];
      End;
  

Begin
  For i:= 1 to 2 do
    For j:= 1 to 2 do
      D[i, j]:= 1/4 * C[i, j];
      End;
  
  
Begin
  For i:= 1 to 2 do
    For j:= 1 to 2 do
      Writeln (D[i, j]);
      Readln;
      End;
End.
  
  
  



Do you like this post? Please link back to this article by copying one of the codes below.

URL Of Post:


HTML Link Code:

BB (forum) link code:

Comments