RosettaCodeData/Task/Square-but-not-cube/Nim/square-but-not-cube.nim
2023-07-01 13:44:08 -04:00

14 lines
205 B
Nim

var count = 0
var n, c, c3 = 1
while count < 30:
var sq = n * n
while c3 < sq:
inc c
c3 = c * c * c
if c3 == sq:
echo sq, " is square and cube"
else:
echo sq
inc count
inc n