procedure TForm1.Button1Click(Sender: TObject);
var ten,five,two,one:integer;
begin
memo1.Clear ;
memo1.Lines.Add('ten five two one');
for ten:=1 to 9do
for five:=1 to 17-tendo
for two:=1 to 42-five-tendo
for one:=1 to 84 -ten-five-twodo
if (10*ten+5*five+2*two+one=100) and (ten+five+two+one=40) then
Memo1.Lines.Add(inttostr(ten)+' '+inttostr(five)+' '
+ inttostr(two)+' '+inttostr(one)+' ');
end;