The given below is a Pascal Program of Matrix Multiplication that takes advantage of the logic behind matrices

What it does is use the FOR loop statement in Pascal to multiply a matrix (A) with 1 row and 5 columns with another matrix (B) of the same size.

Now,

The values required for this computation will be entered by the user while the result of the computation will be sent to the last matrix C.

The resulting matrix after the multiplication will also have 1 row and 5 columns.

The same logic used in solving matrixes in mathematics is employed in this program, hence, it is easy to understand and write yours as well.

## Program Code

program NameArray;

var

A , B, C : Array [1..5,1..5] of integer;

d, e : integer;

Begin

for d := 1 to 5 do

Begin

for e := 1 to 5 do

Begin

writeln ('input your numbers for A');

readln (A[d , e] );

end;

end;

begin

writeln;

for d := 1 to 5 do

begin

for e := 1 to 5 do

begin

writeln ('enter a number for b');

readln (B [d , e] );

end;

end;

begin

for d:= 1 to 5

begin

for e:= 1 to 5

C [d , e] := C [d ,e] + A [d , e] × B [ d, e];

end;

writeln (' The answers are');

readln;

writeln;

writeln;

for d := 1 to 5 do

begin

for e := 1 to 5 do

write ( C[ d, e], ' ' :2);

Writeln;

end;

end;

end;

readln;

End.

var

A , B, C : Array [1..5,1..5] of integer;

d, e : integer;

Begin

for d := 1 to 5 do

Begin

for e := 1 to 5 do

Begin

writeln ('input your numbers for A');

readln (A[d , e] );

end;

end;

begin

writeln;

for d := 1 to 5 do

begin

for e := 1 to 5 do

begin

writeln ('enter a number for b');

readln (B [d , e] );

end;

end;

begin

for d:= 1 to 5

begin

for e:= 1 to 5

C [d , e] := C [d ,e] + A [d , e] × B [ d, e];

end;

writeln (' The answers are');

readln;

writeln;

writeln;

for d := 1 to 5 do

begin

for e := 1 to 5 do

write ( C[ d, e], ' ' :2);

Writeln;

end;

end;

end;

readln;

End.

This is Pascal programming language example using statements and commands.

The end result of this program has been formatted to display in form of a matrix. For more Pascal examples, you can check one of the posts outlined below.