diff --git a/cpp/liquid/liquid b/cpp/liquid/liquid new file mode 100755 index 0000000..853ab28 Binary files /dev/null and b/cpp/liquid/liquid differ diff --git a/cpp/liquid/src/ml_lcm.c b/cpp/liquid/src/ml_lcm.c index f91c807..d397a0c 100644 --- a/cpp/liquid/src/ml_lcm.c +++ b/cpp/liquid/src/ml_lcm.c @@ -3,6 +3,16 @@ int ml_lcm(int n1, int n2) // Compute the LCM(n1, n2) { + int i,a; + if(n1>n2) + a=n1; + else + a=n2; + for(i=a;;i++) + { + if(a%n1==0 && a%n2==0) + return a; + } return 0; } diff --git a/cpp/liquid/src/ml_lcm.c~ b/cpp/liquid/src/ml_lcm.c~ new file mode 100644 index 0000000..c478fb7 --- /dev/null +++ b/cpp/liquid/src/ml_lcm.c~ @@ -0,0 +1,17 @@ +#include "math-lib.h" + +int ml_lcm(int n1, int n2) +// Compute the LCM(n1, n2) +{ + if(n1>n2) + a=n1; + else + a=n2; + for(i=a;;i++) + { + if(a%n1==0 && a%n2==0) + return a; + } + +} +