Anonymous user
Pascal's triangle: Difference between revisions
m
→{{header|REXX}}: added comments in the header section about creating a disk file vs. displaying the triangle. -- ~~~~
m (→{{header|REXX}}: removed ''height'' from ''style''. -- ~~~~) |
m (→{{header|REXX}}: added comments in the header section about creating a disk file vs. displaying the triangle. -- ~~~~) |
||
Line 1,961:
=={{header|REXX}}==
There is no pratical limit for this version, triangles up to 46
<br>window 620 pixels wide.
<br><br>If the number specified is negative, the output is written to a file instead. Triangles up to
<br>1000 rows have been created. The file created is named: '''PASCALS.n'''
<br>where '''n''' is the absolute value of the number entered.
<lang rexx>/*REXX program to display Pascal's triangle, neatly centered/formatted.*/
/*AKA: Yang Hui's ▲, Khayyam-Pascal ▲, Kyayyam ▲, Tartaglia's ▲ */
numeric digits
arg
a.=1 /*if NN < 0, output is to a file.*/
▲mx=!(n-1)/!(n%2)/!(n-1-n%2) /*MX =biggest number in triangle.*/
w=length(mx) /* W =width of biggest number. */
line.=1
Line 1,986 ⟶ 1,988:
do L=1 for n /*show lines in Pascal's triangle*/
if nn>0 then say center(line.L,width) /*either SAY or write.*/
else call lineout 'PASCALS.'n,center(line.L,width)
end /*L*/
exit
|