1) const x0=1.0; xk=2.0; h=0.1; var x,y:real; i:integer; begin x:=x0-h; for i:=1 to round((xk-x0)/h)+1 do begin x:=x+h; y:=x*cos(x)+sin(x); writeln(x:3:1,y:7:3); end; end.
2) const x0=1.0; xk=2.0; h=0.1; var x,y:real; begin x:=x0-h; while x<xk do begin x:=x+h; y:=x*cos(x)+sin(x); writeln(x:3:1,y:7:3); end; end.
const x0=1.0; xk=2.0; h=0.1;
var x,y:real; i:integer;
begin
x:=x0-h;
for i:=1 to round((xk-x0)/h)+1 do
begin
x:=x+h;
y:=x*cos(x)+sin(x);
writeln(x:3:1,y:7:3);
end;
end.
2)
const x0=1.0; xk=2.0; h=0.1;
var x,y:real;
begin
x:=x0-h;
while x<xk do
begin
x:=x+h;
y:=x*cos(x)+sin(x);
writeln(x:3:1,y:7:3);
end;
end.
Результат:
1.0 1.382
1.1 1.390
1.2 1.367
1.3 1.311
1.4 1.223
1.5 1.104
1.6 0.953
1.7 0.773
1.8 0.565
1.9 0.332
2.0 0.077