Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- type
- mang = array[1..10,1..10] of byte;
- var
- f:text;
- i,j:byte;
- a,b,c:mang;
- n:byte;
- begin
- clrscr;
- {$I-}
- assign(f,'input.txt');
- {Doc file}
- reset(f);
- {$I+}
- {Kiem tra ton tai file khong}
- if IOResult<>0 then
- begin
- write('Khong tim thay file');
- readln;
- exit;
- end;
- readln(f,n);
- readln(f);
- for i:=1 to n do
- begin
- for j:=1 to n do read(f,a[i,j]);
- readln(f);
- end;
- readln(f);
- for i:=1 to n do
- begin
- for j:=1 to n do read(f,b[i,j]);
- readln(f);
- end;
- close(f);
- {tinh tong}
- for i:=1 to n do
- for j:=1 to n do
- c[i,j]:=a[i,j]+b[i,j];
- {ghi file}
- append(f);
- writeln(f);
- writeln(f,'Ma tran c');
- for i:=1 to n do
- begin
- for j:=1 to n do write(f,c[i,j]:3);
- writeln(f);
- end;
- close(f);
- end.
Advertisement
Add Comment
Please, Sign In to add comment