Square but not cube: Difference between revisions

Add PL/I
(Add PL/I)
Line 1,932:
{1,64,729,4096,15625,46656,117649,262144,531441,1000000,1771561,2985984,4826809,7529536,11390625}
</pre>
 
=={{header|PL/I}}==
<lang pli>squareNotCube: procedure options(main);
square: procedure(n) returns(fixed);
declare n fixed;
return(n * n);
end square;
cube: procedure(n) returns(fixed);
declare n fixed;
return(n * n * n);
end cube;
declare (ci, si, seen) fixed;
ci = 1;
do si = 1 repeat(si + 1) while(seen < 30);
do while(cube(ci) < square(si));
ci = ci + 1;
end;
if square(si) ^= cube(ci) then do;
put edit(square(si)) (F(5));
seen = seen + 1;
if mod(seen,10) = 0 then put skip;
end;
end;
end squareNotCube;</lang>
{{out}}
<pre> 4 9 16 25 36 49 81 100 121 144
169 196 225 256 289 324 361 400 441 484
529 576 625 676 784 841 900 961 1024 1089</pre>
 
=={{header|PL/M}}==
2,094

edits