-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.pas
More file actions
43 lines (31 loc) · 767 Bytes
/
Copy pathexample.pas
File metadata and controls
43 lines (31 loc) · 767 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
program add(input, output);
(*** Simple program to add 2 integer arrays element by element. ***)
const
size = 5;
type
intarray = array [1..size] of integer;
var
i: integer;
a: intarray;
(* *************************** adder ********************************** *)
procedure adder(var a,b : intarray);
var
i: integer;
begin
for i := 1 to size do
b[i] := a[i] + b[i];
end;
(* ************************** main ********************************** *)
begin
for i := 1 to size do
a[i] := i;
writeln('The array before call to adder:');
for i := 1 to size do
write (a[i]);
writeln;
adder(a,a);
writeln('The array after call to adder:');
for i := 1 to size do
write (a[i]);
writeln;
end.