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 a tech blogger from Cross River State, Nigeria. She studied Computer Science in University of Calabar and is a lover of tech, music and the Internet. You can follow her on Facebook and Google+

0 comments:

Post a Comment