Создаёшь в папке с программой два текстовых файла с именами "1.txt." и "output.txt". В первый записываешь 8 чисел без пробелов и запятых ("22031991", например).
type matrix = array [1..8] of integer;var F, output: text; i, n, cc, sum: integer; c: char; x: matrix; ma: real; procedure convert (var c: char; var cc: integer);begin if c='1' then cc:=1; if c='2' then cc:=2; if c='3' then cc:=3; if c='4' then cc:=4; if c='5' then cc:=5; if c='6' then cc:=6; if c='7' then cc:=7; if c='8' then cc:=8; if c='9' then cc:=9; if c='0' then cc:=0;end; procedure sorting (n: integer; x: matrix);begin for n:=1 to 7 do begin if x[n]>x[n+1] then swap(x[n],x[n+1]); end;end; begin Assign(F, '1.txt'); Reset(F); for i:=1 to 8 do begin read(F, c); convert(c,cc); x[i]:=cc; end; Close(F); sorting(n,x); sum:=x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+x[8]; ma:=sum/8; Assign(output, 'output.txt'); rewrite(output); writeln(output, sum); writeln(output, ma); Close(output);end.
program we;
const
е=0.01;
ro=0.57;
ty=280;
tz=320;
py=180;
p_kr=4.695;
t_kr=190.55;
n=8;
m=21;
type sm=array [1..8] of real;
const x_i: sm=(0.841,0.023,0.069,0.009,0.019,0.014,0.013,0.012);
t_i: sm=(190.55,305.43,369.82,425.16,408.13,469.65,460.39,507.35);
p_i: sm=(46.95,49.76,44.33,38.71,37.19,34.35,34.48,30.72);
var sa,sb: real; i: integer;
a_sm, b_sm,ppkr,tpkr: sm;
p_2,p1,p_sr,p_pr,t_sr,t_pr,pz,dp,t_x,t_pl,g,dt,h,p2,pl,p_x,s,c_r,b,c,a,c_st,f_a,f_b,f_c,z_sr,z,x1,l,sppkr,stpkr: real;
function fz(x1: real): real;
begin
fz: =exp(ln(x1)*3)-sqr(x1)+x1*p_sr*(sqr(sb)*p_sr+sa-sb)-sa*sb*sqr(p_sr);
end;
begin
sa: =0;
sb: =0;
sppkr: =0;
stpkr: =0;
for i: =1 to 8 do
begin
a_sm[i]: =((0.0867*t_i[i])/(p_i[i]*t_sr))*x_i[i];
b_sm[i]: =((0.4278*sqr(t_i[i])*sqrt(/(p_i[i]*sqr(t_sr)*sqrt(*x_i[i];
ppkr[i]: =(p_i[i]*x_i[i]);
tpkr[i]: =(t_i[i]*x_i[i]);
sa: =sa+a_sm[i];
sb: =sb+b_sm[i];
sppkr: =sppkr+ppkr[i];
stpkr: =stpkr+tpkr[i];
end;
l: =0;
for i: =1 to m do
begin
p_2: = py;
t_sr: =(ty+tz)/2;
repeat;
p1: = p_2;
p_sr: =(p1+p_2)/2;
p_pr: =p1/sppkr;
t_pr: =t_sr/stpkr;
a: =0;
b: =1;
repeat
f_a: =fz(a);
f_b: =fz(b);
c: =(a+b)/2;
f_c: =fz(c);
if(f_c*f_a)< 0 then b: =c
else a: =c;
c_st: =(a+b)/2;
until (abs(c_st-c)) z_sr: =c;
s: =0.03415*(ro*l)/(z_sr*t_sr);
pz: =py*exp(s);
p_2: = pz*exp(s);
dp: =pz-p1;
p_2: =pz;
until dp l: =l+100;
writeln ('l=', l, ' p=', p_2, ' z=', z_sr );
end;
end.
type matrix = array [1..8] of integer;var F, output: text; i, n, cc, sum: integer; c: char; x: matrix; ma: real;
procedure convert (var c: char; var cc: integer);begin if c='1' then cc:=1; if c='2' then cc:=2; if c='3' then cc:=3; if c='4' then cc:=4; if c='5' then cc:=5; if c='6' then cc:=6; if c='7' then cc:=7; if c='8' then cc:=8; if c='9' then cc:=9; if c='0' then cc:=0;end;
procedure sorting (n: integer; x: matrix);begin for n:=1 to 7 do begin if x[n]>x[n+1] then swap(x[n],x[n+1]); end;end;
begin Assign(F, '1.txt'); Reset(F); for i:=1 to 8 do begin read(F, c); convert(c,cc); x[i]:=cc; end; Close(F);
sorting(n,x); sum:=x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+x[8]; ma:=sum/8; Assign(output, 'output.txt'); rewrite(output); writeln(output, sum); writeln(output, ma); Close(output);end.