Перевести этот код delphi в паскаль, program taskformula; uses var x, a, xn, xk, dx, sum, multiplnegative: real; countnegative: integer; j,m,f: real; y: real; begin writeln('a --> '); read(a); writeln(' xn --> '); read(xn); writeln(' xk --> '); read(xk); writeln(' dx --> '); read(dx); sum : = 0; multiplnegative : = 1; countnegative : = 0; x : = xn; while (x < = xk) do begin if (a+x < 0) then begin f: =(a+x)*-1; f: =ln(f)*(-1); j: = roundto(abs(a-sqr(x)) * f,-5); end else j: = roundto(abs(a-sqr(x)) * ln(a+); m: = power(sqr(x),1/3)+ power(a,1/5); if j< 0 then begin j: =j*(-1); j: = power(j, 1/3); j: =j*(-1); end else j: = power(j, 1/3); y: = roundto(j/m,-5); write('x= ',x: 5: 3,' '); writeln('y= ',y: 7: 5); if y< 0 then begin sum : = sum + y; multiplnegative : = multiplnegative * y; inc(countnegative); end; x: = x + dx; end; writeln; writeln(' y = ',countnegative); writeln('y = ',sum: 7: 5); writeln(' y = ',multiplnegative: 7: 5); readln; end.
y, x, a, xn, xk, dx, sum, multiplNegative: real;
countNegative: integer;
j, m, f: real;
begin
write('a --> ');
Read(a);
write(' xn --> ');
Read(xn);
write(' xk --> ');
Read(xk);
write(' dx --> ');
Read(dx);
sum := 0;
multiplNegative := 1;
countNegative := 0;
x := xn;
while (x <= xk) do
begin
if (a + x < 0) then begin
f := (a + x) * -1;
f := ln(f) * (-1);
j := Round(abs(a - sqr(x)) * f * 100000) / 100000;
end
else
j := Round(abs(a - sqr(x)) * ln(a + x) * 100000) / 100000;
m := Power(sqr(x), 1 / 3) + Power(a, 1 / 5);
if j < 0 then begin
j := j * (-1);
j := Power(j, 1 / 3);
j := j * (-1);
end
else
j := Power(j, 1 / 3);
y := Round(j / m * 100000) / 100000;
write('x= ', x:5:3, ' ');
writeln('y= ', y:7:5);
if y < 0 then
begin
sum := sum + y;
multiplNegative := multiplNegative * y;
inc(countNegative);
end;
x := x + dx;
end;
writeln;
writeln(' y = ', countNegative);
writeln('y = ', sum:7:5);
writeln(' y = ', multiplNegative:7:5);
Readln;
end.