1) const eps=0.5e-6; var x,xn,a0,a1:real; begin readln(x,a0); xn:=1; while abs(a0-a1)>=eps do begin a0:=a1; xn:=x*xn; a1:=sin(1+a0*a0*a0)/xn; end; writeln(a1); end.
2) const eps=0.5e-6; var x,xn,a0,a1:real; begin readln(x,a0); xn:=1; repeat a0:=a1; xn:=x*xn; a1:=sin(1+a0*a0*a0)/xn; until abs(a0-a1)<eps; writeln(a1); end.
Answers & Comments
Verified answer
1)const eps=0.5e-6;
var x,xn,a0,a1:real;
begin
readln(x,a0);
xn:=1;
while abs(a0-a1)>=eps do
begin
a0:=a1;
xn:=x*xn;
a1:=sin(1+a0*a0*a0)/xn;
end;
writeln(a1);
end.
2)
const eps=0.5e-6;
var x,xn,a0,a1:real;
begin
readln(x,a0);
xn:=1;
repeat
a0:=a1;
xn:=x*xn;
a1:=sin(1+a0*a0*a0)/xn;
until abs(a0-a1)<eps;
writeln(a1);
end.
Пример:
1.2 0.9
2.41185904021433E-006