var x,y: real;
begin
write('x = ');
readln(x);
if x<=0 then y:=-x
else if x<=2 then y:=x
else if x<=4 then y:=4-x
else y:=x-4;
writeln('y = ',y:4:1);
end.
Пример:
x = 3
y = 1.0
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
var x,y: real;
begin
write('x = ');
readln(x);
if x<=0 then y:=-x
else if x<=2 then y:=x
else if x<=4 then y:=4-x
else y:=x-4;
writeln('y = ',y:4:1);
end.
Пример:
x = 3
y = 1.0