Отправил.
Procedure TForm1.Button1Click(Sender: TObject);
var i,min,qw,bx:integer;
begin qw:=strtoint(edit1.Text);
bx:=strtoint(edit2.Text);
if qw>bx then min:=a else
min:=bx;
for i := 1to min do
if (qw mod i = 0) and (bx mod i = 0)
then
begin qw:=bx div i;
bx:=bx div i;
end;
edit1.Text:=inttostr(qw);
edit2.Text:=inttostr(bx);
end;