-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathArray_with_Procedure.pas
More file actions
62 lines (47 loc) · 939 Bytes
/
Array_with_Procedure.pas
File metadata and controls
62 lines (47 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
program Demo2_3;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
Arr = Array [1..10, 1..10] of Integer;
Var
I, J, N: Integer;
A, B, C: Arr;
procedure Input(M: Integer; Var C: Arr);
var
I, J: Integer;
begin
for I := 1 to M do
for J := 1 to M do
ReadLn(C[I, J]);
end;
procedure Output(M: Integer; C: Arr; DefaultParam: String = ':');
var
I, J: Integer;
begin
DefaultParam := '--';
for I := 1 to M do
begin
for J := 1 to M do
Write(C[I, J]: 2, DefaultParam);
WriteLn;
end;
end;
begin
Write('N = '); ReadLn(N);
WriteLn('Array A');
Input(N, A);
WriteLn('Array B');
Input(N, B);
for I := 1 to N do
for J := 1 to N do
C[I, J] := A[I, J] + B[I, J];
WriteLn('Array A');
Output(N, A);
WriteLn('Array B');
Output(N, B);
WriteLn('Array C');
Output(N, C);
ReadLn; // pause
end.