Pascal's triangle/Puzzle: Difference between revisions

Added XPL0 example.
(→‎{{header|C++}}: new entry)
(Added XPL0 example.)
Line 2,781:
<pre>
Solution is: x = 5, y = 13, z = 8
</pre>
 
=={{header|XPL0}}==
<lang XPL0>proc Print; int N, A, B, C, D, E;
int I, P;
def Tab = $09;
[P:= @A; \point to first number
for I:= N to 5-1 do ChOut(0, Tab);
for I:= 0 to N-1 do
[IntOut(0, P(I)); ChOut(0, Tab); ChOut(0, Tab)];
CrLf(0);
];
 
int N, P, Q, R, S, T, U, V, W, X, Y, Z; \ 151
[for X:= 0 to 40-11 do \ N P
for Z:= 0 to 151-4 do \ Q R S
[Y:= X+Z; \ T U V W
T:= X+11; \X 11 Y 4 Z
U:= 11+Y;
V:= Y+4;
W:= 4+Z;
if T+U = 40 then
[R:= U+V;
S:= V+W;
N:= 40+R;
P:= R+S;
if N+P = 151 then
[Print(1, 151);
Print(2, N, P);
Print(3, 40, R, S);
Print(4, T, U, V, W);
Print(5, X, 11, Y, 4, Z);
exit;
];
];
];
]</lang>
 
{{out}}
<pre>
151
81 70
40 41 29
16 24 17 12
5 11 13 4 8
</pre>
 
772

edits