Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program matrix;
- const n=2;
- l=3;
- m=4;
- var
- i,j,k:integer;
- a:array[1..n,1..l] of integer;
- b:array[1..l,1..m] of integer;
- c:array[1..n,1..m] of integer;
- begin
- writeln;
- writeln('enter matrix a[',n,'*',l,']:');
- for i:=1 to n do
- for k:=1 to l do
- read(a[i,k]);
- writeln;
- writeln('enter matrix b[',l,'*',m,']:');
- for k:=1 to l do
- for j:=1 to m do
- read(b[k,j]);
- for i:=1 to n do
- for j:=1 to m do
- begin
- c[i,j]:=0;
- for k:=1 to l do
- c[i,j]:=a[i,k]*b[k,j]+c[i,j];
- end;
- writeln;
- writeln('matrix c=a*b:');
- for i:=1 to n do
- begin
- for j:=1 to m do
- write(c[i,j],' ':2);
- writeln;
- end;
- readln;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment