Jump to content

Odd and square numbers: Difference between revisions

→‎{{header|Euler}}: Sybntax highlight with Mediawiki markup
imported>Maxima enthusiast
No edit summary
(→‎{{header|Euler}}: Sybntax highlight with Mediawiki markup)
Line 392:
Same algorithm as the Algol and other samples.
<br>Note formatted output is not Euler's strong point...
'''begin'''
<syntaxhighlight lang="euler">
'''new''' toNext; '''new''' oddSquare; '''label''' again;
begin
new toNext; new oddSquare; label again;
toNext &lt;- 0;
 
toNext oddSquare <&lt;- 01;
again:
oddSquare <- 1;
'''if''' oddSquare &lt; 1000 '''then''' '''begin'''
again:
'''if''' oddSquare <&gt; 100099 '''then''' '''out''' oddSquare '''else''' begin0;
if oddSquare > 99 then out&lt;- oddSquare else+ 0toNext;
oddSquare <toNext &lt;- oddSquaretoNext + toNext8;
toNext '''goto''' <- toNext + 8;again
'''end''' '''else''' 0
goto again
end else 0
'''end''' $
 
end $
</syntaxhighlight>
{{out}}
<pre>
3,048

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.