Square but not cube: Difference between revisions

Content added Content deleted
(Add Comal)
(Added XPL0 example.)
Line 3,409: Line 3,409:
The first 3 positive integers which are both squares and cubes are:
The first 3 positive integers which are both squares and cubes are:
[1, 64, 729]
[1, 64, 729]
</pre>

=={{header|XPL0}}==
<lang XPL0>int C, N, N2, T;
[C:= 0; N:= 1;
loop [N2:= N*N;
IntOut(0, N2);
T:= fix(Pow(float(N2), 1./3.));
if T*T*T # N2 then
[ChOut(0, ^ );
C:= C+1;
if C >= 30 then quit;
]
else Text(0, "* ");
N:= N+1;
];
Text(0, "^m^j* are both squares and cubes.^m^j");
]</lang>

{{out}}
<pre>
1* 4 9 16 25 36 49 64* 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729* 784 841 900 961 1024 1089
* are both squares and cubes.
</pre>
</pre>