Smallest square that begins with n: Difference between revisions

Add Comal
(Add Draco)
(Add Comal)
Line 618:
484
49</pre>
 
=={{header|Comal}}==
<lang comal>0010 FUNC begins'with(n,s)
0020 WHILE n>s DO n:=n DIV 10
0030 RETURN n=s
0040 ENDFUNC begins'with
0050 //
0060 FUNC smallest'square(a)
0070 sq:=1
0080 WHILE NOT begins'with(sq^2,a) DO sq:+1
0090 RETURN sq^2
0100 ENDFUNC smallest'square
0110 //
0120 ZONE 7
0130 FOR i:=1 TO 49 DO
0140 PRINT smallest'square(i),
0150 IF i MOD 10=0 THEN PRINT
0160 ENDFOR i
0170 PRINT
0180 END</lang>
{{out}}
<pre>1 25 36 4 529 64 729 81 9 100
1156 121 1369 144 1521 16 1764 1849 196 2025
2116 225 2304 2401 25 2601 2704 289 2916 3025
3136 324 3364 3481 35344 36 3721 3844 3969 400
41209 4225 4356 441 45369 4624 4761 484 49</pre>
 
=={{header|Cowgol}}==
2,124

edits