const
size = 10;
type
vector = array of integer;
var
arr:vector;
function average(arr:vector):real;
var sum:=0;
begin
for var i:=0 to length(arr)-1 do
sum:=sum + arr[i];
average:=sum / length(arr);
end;
SetLength(arr, size);
write('Заполним массив 10 числами: ', #10);
for var i:= 0 to size-1 do
arr[i]:=random(25);
write(arr[i], ' ');
write(#10, 'Среднее арифметическое = ', average(arr));
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
const
size = 10;
type
vector = array of integer;
var
arr:vector;
function average(arr:vector):real;
var sum:=0;
begin
for var i:=0 to length(arr)-1 do
sum:=sum + arr[i];
average:=sum / length(arr);
end;
begin
SetLength(arr, size);
write('Заполним массив 10 числами: ', #10);
for var i:= 0 to size-1 do
begin
arr[i]:=random(25);
write(arr[i], ' ');
end;
write(#10, 'Среднее арифметическое = ', average(arr));
end.