uses Math;
var
y, f: real
begin
Write ('Введите Y: ');
Readln (y);
if (y >= 1.2) and (y <= 2.5) then
f := Sin (y)
else
f := Power (y, 3) - 0.5;
Writeln ('y = ' + FloatToStr (f));
end;
P.S программа написана для Pascal
program fun;
function f( a: real): real;
var x:real;
if (a<1.2) or (a>2.5) then
x:=a*a*a-0.5;
if (a>=1.2) and (a<=2.5) then
x:=sin(a);
f:=x;
y: real;
writeln('Введите y');
read(y);
writeln('f=',f(y):0:2);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
uses Math;
var
y, f: real
begin
Write ('Введите Y: ');
Readln (y);
if (y >= 1.2) and (y <= 2.5) then
f := Sin (y)
else
f := Power (y, 3) - 0.5;
Writeln ('y = ' + FloatToStr (f));
end;
P.S программа написана для Pascal
program fun;
function f( a: real): real;
var x:real;
begin
if (a<1.2) or (a>2.5) then
x:=a*a*a-0.5;
if (a>=1.2) and (a<=2.5) then
x:=sin(a);
f:=x;
end;
var
y: real;
begin
writeln('Введите y');
read(y);
writeln('f=',f(y):0:2);
end.