Odd and square numbers: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (added Arturo) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 812: | Line 812: | ||
</pre> |
</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">lo, hi = 100, 1000 |
|||
(Integer.sqrt(lo)..Integer.sqrt(hi)).each{|n| puts n*n if n.odd?}</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
121 |
|||
169 |
|||
225 |
|||
289 |
|||
361 |
|||
441 |
|||
529 |
|||
625 |
|||
729 |
|||
841 |
|||
961 |
|||
</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<syntaxhighlight lang="ruby">var lo = 100 |
<syntaxhighlight lang="ruby">var lo = 100 |