Var x,y,x0,xn,h:real; n,i:integer;
begin
x0:=-5; xn:=10; h:=0.5;
n:=round((xn-x0)/h)+1;
x:=x0-h;
writeln(' x y');
for i:=1 to n do
begin
x:=x+h;
if x<-4<br> then y:=-x
else if x<7 then y:=2.87*x<br> else y:=x+1.8;
writeln(x:4:1,y:7:2);
end;
end.
Результат:
x y
-5.0 5.00
-4.5 4.50
-4.0 -11.48
-3.5 -10.05
-3.0 -8.61
-2.5 -7.18
-2.0 -5.74
-1.5 -4.31
-1.0 -2.87
-0.5 -1.44
0.0 0.00
0.5 1.44
1.0 2.87
1.5 4.31
2.0 5.74
2.5 7.18
3.0 8.61
3.5 10.05
4.0 11.48
4.5 12.92
5.0 14.35
5.5 15.79
6.0 17.22
6.5 18.66
7.0 8.80
7.5 9.30
8.0 9.80
8.5 10.30
9.0 10.80
9.5 11.30
10.0 11.80