2015-12-28 14:25:15 +03:00
|
|
|
// Переменное число параметров
|
2015-05-14 22:35:07 +03:00
|
|
|
function Sum(params arg: array of integer): integer;
|
|
|
|
|
begin
|
|
|
|
|
Result := 0;
|
|
|
|
|
foreach x: integer in arg do
|
|
|
|
|
Result += x;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
writeln(Sum(1,2,3));
|
|
|
|
|
writeln(Sum(4,5,6,7));
|
|
|
|
|
end.
|