You are on page 1of 1

Code: function gcd(m,n:longint):longint; begin if n = 0 then gcd:=m else gcd:=gcd(n, m mod n); endhttp://www.pro9ramming.com/lowest-common-multiple-lcm-t-1012.

html; function lcm(m,n:longint):longint; begin lcm:=(m*n) div gcd(m,n); end; And in C++ : Code: int gcd(int a, int b) { if (a == 0) return b; while (!b == 0) if (a > b) a=a-b; else b=b-a; return a; }