Python:
x = float(input())
if x == 0:
y = 0
elif x > 0:
y = abs(x)
elif x < 0:
y = 2 - x
print("f({}) = {}".format(x,y))
Pascal:
var
x,y : real;
begin
readln(x);
if x = 0 then
y := 0
else
if x > 0 then
y := abs(x)
if x < 0 then
y := 2 - x;
write('F(x)=',y:5:5);
end.
Python:
x = float(input())
if x == 0:
y = 0
elif x > 0:
y = abs(x)
elif x < 0:
y = 2 - x
print("f({}) = {}".format(x,y))
Pascal:
var
x,y : real;
begin
readln(x);
if x = 0 then
y := 0
else
if x > 0 then
y := abs(x)
else
if x < 0 then
y := 2 - x;
write('F(x)=',y:5:5);
end.