Steady squares: Difference between revisions
Content added Content deleted
(→{{header|Ruby}}: start from zero) |
(Added Applesoft BASIC and MSX Basic) |
||
Line 220: | Line 220: | ||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
==={{header|Applesoft BASIC}}=== |
|||
{{trans|GW-BASIC}} |
|||
<syntaxhighlight lang="qbasic">100 HOME |
|||
110 FOR n = 1 TO 10000 |
|||
120 m$ = STR$(n) |
|||
130 n2$ = STR$(n*n) |
|||
140 IF RIGHT$(n2$,LEN(m$)) = m$ THEN HTAB(5-LEN(m$)): PRINT m$;"^2 = ";N2$ |
|||
150 NEXT n |
|||
160 END</syntaxhighlight> |
|||
==={{header|ASIC}}=== |
==={{header|ASIC}}=== |
||
Compile with the ''Extended math'' option. |
Compile with the ''Extended math'' option. |
||
Line 395: | Line 405: | ||
9376 ^ 2 = 87909376 |
9376 ^ 2 = 87909376 |
||
</pre> |
</pre> |
||
==={{header|MSX Basic}}=== |
|||
{{trans|GW-BASIC}} |
|||
<syntaxhighlight lang="qbasic">10 CLS |
|||
20 FOR N = 1 TO 10000 |
|||
30 M$ = STR$(N) |
|||
40 M2# = N*N |
|||
50 M$ = RIGHT$(M$,LEN(M$)-1) |
|||
60 N2$ = STR$(M2#) |
|||
70 A = LEN(M$) |
|||
80 IF RIGHT$(N2$,A)= M$ THEN LOCATE 5-LEN(M$): PRINT M$;"^2 =";N2$ |
|||
90 NEXT N |
|||
100 END</syntaxhighlight> |
|||
==={{header|QBasic}}=== |
==={{header|QBasic}}=== |