pascalabcnet/_Presentations/2015 New Features/Programs/25_lambda1-1.pas
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

24 lines
335 B
ObjectPascal

const n = 5;
var a,b: array [1..n] of integer;
i: integer;
function f(x: integer): integer;
begin
f := x*x;
end;
begin
a[1] := 1; a[2] := 5; a[3] := 2;
a[4] := 6; a[5] := 7;
for i:=1 to n do
write(a[i],' ');
writeln;
for i:=1 to n do
b[i] := f(a[i]);
for i:=1 to n do
write(b[i],' ');
end.