Var x,y,a,b,h,min,max:real; i:integer; begin readln(a,b,h); x:=a; y:=2*x*x-0.5*x+5; min:=y; max:=y; writeln(x:4:1,' ',y:6:2); for i:=1 to round((b-a)/h) do begin x:=x+h; y:=2*x*x-0.5*x+5; writeln(x:4:1,' ',y:6:2); if y<min then min:=y; if y>max then max:=y; end; writeln('min = ',min:6:2,' max = ',max:6:2); end.
Answers & Comments
Verified answer
Var x,y,a,b,h,min,max:real; i:integer;begin
readln(a,b,h);
x:=a; y:=2*x*x-0.5*x+5;
min:=y; max:=y;
writeln(x:4:1,' ',y:6:2);
for i:=1 to round((b-a)/h) do
begin
x:=x+h;
y:=2*x*x-0.5*x+5;
writeln(x:4:1,' ',y:6:2);
if y<min then min:=y;
if y>max then max:=y;
end;
writeln('min = ',min:6:2,' max = ',max:6:2);
end.
Пример:
-2 2 0.5
-2.0 14.00
-1.5 10.25
-1.0 7.50
-0.5 5.75
0.0 5.00
0.5 5.25
1.0 6.50
1.5 8.75
2.0 12.00
min = 5.00 max = 14.00