uses crt;
type matran=array[1..20,1..20] of integer;
var a,b,c:matran;
m,n:integer;
procedure nhap(var x:matran);
var i,j:integer;
begin
for i:=1 to m do
for j:=1 to n do
begin
write('nhap phan tu thu ' ,i, ',' ,j, ' cua ma tran : ');
readln(x[i,j]);
end;
end;
procedure tong(var x,y,z:matran);
var i,j:integer;
begin
for i:=1 to m do
begin
for j:=1 to n do
z[i,j]:=x[i,j]+y[i,j]
end;
end;
procedure inmatran(var x:matran);
var i,j:integer;
begin
for i:=1 to m do
begin
for j:=1 to n do
write(a[i,j]:3);
writeln;
end;
end;
begin
clrscr;
write('nhap so hang cua ma tran: '); readln(m);
write('nhap so cot cua ma tran: '); readln(n);
writeln('nhap ma tran a: ');
nhap(a);
writeln('nhap mat tran b: ');
nhap(b);
clrscr;
inmatran(a);
inmatran(b);
writeln;
writeln('tong 2 ma tran la: ');
tong(a,b,c);
inmatran(c);
writeln;
readln;
end.