Поправить код паскаль!
Пусть все x>0 (i=1,2,...n).Отсортируйте по неубыванию средние величины-геометрические, гармонические и квадратичные! Вот фото задания
[ссылка заблокирована по решению администрации проекта]
program func;
type vect=array [1..1000] of real;
const nl=#13#10; w=7; v=3;
var x,y:vect;
var i,j,n: integer;
G,M,Q,s: real;
function G_f(x:vect) : real;
var
G:real;
i,n: integer;
begin
G:=1;
for i := 1 to n do begin
G:=x*G;
end;
G_f:=exp(ln(G)/n);
end;
function Q_f(x:vect) : real;
var
Q:real;
i,n: integer;
begin
Q:=1;
for i := 1 to n do begin
Q:=(Q+x*x);
end;
Q_f:=sqrt(Q/n);
end;
function M_f(x:vect) : real;
var
M:real;
i,n: integer;
begin
M:=1;
for i := 1 to n do begin
M:=M+1/x;
end;
M_f:=n/M;
end;
begin
write(nl, 'n<=10===> ');
read(n);
randomize;
for i:=1 to n do x:=(random(50)+1)/10;
for i:=1 to n do
G:=1; M:=1; Q:=1;
for i:=1 to n do
G:=exp(ln(G_f(x))/n);
M:=n/M_f(x);
Q:=sqrt(Q_f(x)/n);
write(nl,nl,' X ');
for i:=1 to n do write(x:w:v);
writeln;
writeln(' Геометрическое ',G:w:v, ' Гарм ',M:w:v,
' Квадр ',Q:w:v);
writeln(' Отсортированные значения');
y[1]:=G;
y[2]:=M;
y[3]:=Q;
for j:=1 to 2 do
for i:=1 to 3-j do
if y>y[i+1] then
begin
s:=y;
y:=y[i+1];
y[i+1]:=s;
end;
for i:=1 to 3 do write(y:w:v);
end.