0

```
program Q2 (Input,Output);
var
X,Y,T1,T2 : Integer;
Flag1,Flag2,Flag3 : Boolean;
SquareRoot,CubeRoot,Z,D1,D2 : Real;
begin
X := 1;
Flag1 := True;
Flag2 := False;
Flag3 := False;
while Flag1 do
begin
Y := X-1;
SquareRoot := Sqrt(Y);
T1 := Trunc(SquareRoot);
D1 := SquareRoot - T1;
if(D1>0) then
Flag2 := False;
Z := X+1;
CubeRoot := Exp((1/3) * Ln(Z));
T2 := Trunc(CubeRoot);
D2 := CubeRoot - T2;
if(D2>0) then
Flag2 := False;
if ((Flag2) and (Flag3)) then
begin
Flag1 := False;
WriteLn;
Write('Value = ',X,' ',D1,' ',D2);
end
else
X := X + 1;
end;
end.
```

I'm trying to find way to make cube root in Turbo PASCAL but when i use CubeRoot := Exp((1/3) * Ln(Z)); keeps giving me runtime errors this is the question for the homework

It is said that there is only one natural number n such that n-1 is a square and n+1 is a cube that is n-1 = square x and n+1 = cube y for natural numbers x and y. find n in PASCAL