Task

Show the first   30   positive integers which are squares but not cubes of such integers.

Optionally, show also the first   3   positive integers which are both squares and cubes,   and mark them as such.




100 PROGRAM "Square.bas"
110 LET SQNOTCB,SQANDCB,SQNUM,CBNUM,CBN,SQN,D1=0:LET SQD,D2=1
120 DO 
130   LET SQN=SQN+1:LET SQNUM=SQNUM+SQD:LET SQD=SQD+2
140   IF SQNUM>CBNUM THEN
150     LET CBN=CBN+1:LET CBNUM=CBNUM+D2
160     LET D1=D1+6:LET D2=D2+D1
170   END IF 
180   IF SQNUM<>CBNUM THEN
190     PRINT SQNUM:LET SQNOTCB=SQNOTCB+1
200   ELSE 
210     PRINT SQNUM,SQN;"*";SQN;"=";CBN;"*";CBN;"*";CBN
220     LET SQANDCB=SQANDCB+1
230   END IF 
240 LOOP UNTIL SQNOTCB>=30
250 PRINT SQANDCB;"where numbers are square and cube."