Program example5_27;
var
s,n,a,b,c,d,e,f : integer;
begin
n := 0;
for a := 1 to 6 do
for b := 1 to 6 do
if b a then
for c := 1 to 6 do
if (c a) and (c b) then
for d := 1 to 6 do
if (d a) and (d b) and (d c) then
for e := 1 to 6 do
if (e a) and (e b) and (e c) and (e d) then
f := 21-a-b-c-d-e;
s := a+b+c;
if (c+d+e = s) and (a+f+e = s) then begin
n := n+1;
writeln("No.",n:2," : ",a:4);
writeln(b:10,f:4);
writeln(c:8,d:4,e:4);
readln;
end;
end.
Program example5_27;
var
s,n,a,b,c,d,e,f : integer;
begin
n := 0;
for a := 1 to 6 do
for b := 1 to 6 do
if b a then
for c := 1 to 6 do
if (c a) and (c b) then
for d := 1 to 6 do
if (d a) and (d b) and (d c) then
for e := 1 to 6 do
if (e a) and (e b) and (e c) and (e d) then
begin
f := 21-a-b-c-d-e;
s := a+b+c;
if (c+d+e = s) and (a+f+e = s) then begin
n := n+1;
writeln("No.",n:2," : ",a:4);
writeln(b:10,f:4);
writeln(c:8,d:4,e:4);
readln;
end;
end;
end.