Anonymous user
Floyd's triangle: Difference between revisions
m
→version 2, simple formula: added whitespace and comments.
(→{{header|Python}}: Defining just the relationship between successive terms) |
m (→version 2, simple formula: added whitespace and comments.) |
||
Line 3,695:
This REXX version uses a simple formula to calculate the maximum value (triangle element) displayed.
<lang rexx>/*REXX program constructs & displays Floyd's triangle for any number of specified rows.*/
parse arg N .; if N=='' | N=="," then N=
mx= N * (N+1) % 2 -
say 'displaying a ' N " row Floyd's triangle:" /*show the header for Floyd's triangle.*/
say /*display a blank line below the title.*/
#=1; do
say substr(_, 2) /*remove 1st leading blank in the line.*/
end
{{out|output|text= when using the default input:}}
<pre>
|