Pascal's triangle/Puzzle: Difference between revisions

m
→‎{{header|REXX}}: changed whitespace.
No edit summary
m (→‎{{header|REXX}}: changed whitespace.)
Line 2,196:
=={{header|REXX}}==
<lang rexx>/*REXX program solves a (Pascal's) "Pyramid of Numbers" puzzle given four values. */
/* ╔══════════════════════════════════════════════════╗
/*╔══════════════════════════════════════════════════════╗
answer answer
/ /
mid mid / /
\ \ 151 151
\ ααα \ ααα ααα
40 ααα ααα
ααα ααα ααα ααα ααα
x 11 y 4 z
/ / \ \
║ find: / / \ \
║ x y z b b d d
╚══════════════════════════════════════════════════╝ */
╚══════════════════════════════════════════════════════╝*/
do #=2; _= sourceLine(#); n= pos('_', _) /* [↓] this DO loop shows (above) box.*/
if n\==0 then leave; say _ say _ /*only display up to the above line. */
end /*#*/; say say /* [↑] this is a way for in─line doc. */
parse arg b d mid answer . /*obtain optional variables from the CL*/
if b=='' | b=="," then b= 11 /*Not specified? Then use the default.*/
Line 2,223:
do z=-big to big
if z \== y - x then iterate /*Z has to equal Y-X (Y= X+Z) */
if x+y*6+z==big then say right('x =', n) x right("y =",n) y right('z =',n) z
end /*z*/
end /*y*/
Line 2,229:
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
/* ╔══════════════════════════════════════════════════╗
/*╔══════════════════════════════════════════════════════╗
answer answer
/ /
mid mid / /
\ \ 151 151
\ ααα \ ααα ααα
40 ααα ααα
ααα ααα ααα ααα ααα
x 11 y 4 z
/ / \ \
║ find: / / \ \
║ x y z b b d d
╚══════════════════════════════════════════════════╝ */
╚══════════════════════════════════════════════════════╝*/
 
x = 5 y = 13 z = 8
</pre>