Title: How to calculate gcd using Euklid algorithm
function gcd(a, b: Integer): Integer;
var
rest: Integer;
begin
//ggT Berechnung nach dem Algorithmus von Euklid
//Konvergiert sehr schnell!
//gcd using Euklid algorithm
//converge very fast
repeat
rest := a mod b;
a := b;
b := rest;
until (rest = 0);
Result := abs(a);
//ggT is immer positiv
//gcd is always positive
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(IntToStr(gcd(12,30)));
end;