RosettaCodeData/Task/Square-but-not-cube/Phix/square-but-not-cube.phix
2026-02-01 16:33:20 -08:00

18 lines
511 B
Text

integer square = 1, squared = 1*1,
cube = 1, cubed = 1*1*1,
count = 0
while count<30 do
squared = square*square
while squared>cubed do cube += 1; cubed = cube*cube*cube end while
if squared=cubed then
printf(1,"%d: %d == %d^3\n",{square,squared,cube})
else
count += 1
printf(1,"%d: %d\n",{square,squared})
end if
square += 1
end while
printf(1,"\nThe first 15 positive integers that are both a square and a cube: \n")
?sq_power(tagset(15),6)