Steady squares: Difference between revisions

→‎{{header|ABC}}: Better (?) code
(Added ABC)
(→‎{{header|ABC}}: Better (?) code)
Line 7:
=={{header|ABC}}==
<syntaxhighlight lang="abc">
HOW TO REPORT n is.steady.square.below power.of.ten:
REPORT ( n * n ) mod power.of.ten = n
 
HOW TO REPORTMIGHT n show.possible.steady.squareBE A STEADY SQUARE BELOW power.of.ten:
IF n is.steady.square.below power.of.ten:
WRITE ( ( ( n << 1 ) ^ "^2 = " ) >> 10 ) ^ ( ( n * n ) >> 1 ) /
SUCCEED
 
PUT 10 IN power.of.ten
Line 21 ⟶ 20:
IF n = power.of.ten:
PUT power.of.ten * 10 IN power.of.ten
IFMIGHT ( n + 1 ) show.possible.steady.squareBE A STEADY SQUARE BELOW power.of.ten: PASS
IFMIGHT ( n + 5 ) show.possible.steady.squareBE A STEADY SQUARE BELOW power.of.ten: PASS
IFMIGHT ( n + 6 ) show.possible.steady.squareBE A STEADY SQUARE BELOW power.of.ten: PASS
</syntaxhighlight>
{{out}}
3,038

edits