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.
  
  
  


Share on Google Plus

About Grace Joseph

Grace Joseph is from Cross River State, Nigeria. She studied Computer Science in University of Calabar and has great passion for writing, technology and blogging.

0 comments:

Post a Comment