Odd and square numbers: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add FOCAL) |
Not a robot (talk | contribs) (Add Cowgol) |
||
Line 163: | Line 163: | ||
MULTIPLY N BY N GIVING SQR. |
MULTIPLY N BY N GIVING SQR. |
||
IF ODD, MOVE SQR TO FMT, DISPLAY FMT.</lang> |
IF ODD, MOVE SQR TO FMT, DISPLAY FMT.</lang> |
||
{{out}} |
|||
<pre>121 |
|||
169 |
|||
225 |
|||
289 |
|||
361 |
|||
441 |
|||
529 |
|||
625 |
|||
729 |
|||
841 |
|||
961</pre> |
|||
=={{header|Cowgol}}== |
|||
<lang cowgol>include "cowgol.coh"; |
|||
var n: uint16 := 10; |
|||
loop |
|||
var sq := n * n; |
|||
if sq >= 1000 then break; end if; |
|||
if sq % 2 == 1 then |
|||
print_i16(sq); |
|||
print_nl(); |
|||
end if; |
|||
n := n+1; |
|||
end loop;</lang> |
|||
{{out}} |
{{out}} |
||
<pre>121 |
<pre>121 |