Подскажите, где ошибка: program mas2; const n=5; type mas=array[1..n]of real; var sr,sum: real; i: integer; x: mas; procedure vvod_rand(var a: mas; n: integer); var i: integer; begin for i: =1 to n do begin a[i]: =random(-10,30); write(a[i],' '); end; writeln; end; var a: mas; function sred(var x: mas; s: real): real; var i: integer; begin s: =0; for i: =1 to n do s: =x[i]+s; s: =s/5; sred: =s end; function summa(var x: mas; su: real): real; var i: integer; begin su: =0; for i: =1 to n do su: =su+x[i]; writeln('sum=',sum); end; begin vvod_rand(a,n); writeln('sum=',summa(sum,a)); writeln('sred=',sred(a,sr)); end. написал на pascalabc.net заранее .
const
n=5;
type
mas=array[1..n]of real;
var
sr,sum:real;
i:integer;
x:mas;
procedure vvod_rand(var A:mas; n: integer);
var
i:integer;
begin
for i:=1 to n do
begin
a[i]:=random(-10,30);
write(a[i],' ');
end;
writeln;
end;
function sred(var x:mas):real;
var
i:integer;
s:real;
begin
s:=0;
for i:=1 to n do s:=x[i]+s;
s:=s/5;
sred:=s
end;
function summa(var x:mas):real;
var
i:integer;
su:real;
begin
su:=0;
for i:=1 to n do su:=su+x[i];
summa:=su;
end;
var a:mas;
begin
vvod_rand(a,n);
writeln('sum=',summa(a));
writeln('sred=',sred(a));
end.
function summa(var x: mas; su: real): real;
var
i: integer;
begin
su := 0;
for i := 1 to n do
su := su + x[i];
summa:=su;
writeln('sum=', su);
end;