package number;

public class GcdLcm {
	public static int gcd(int x, int y) {if (y==0) {return x;}return gcd(y,x%y);}
	public static int lcm(int... x) {
		int tmp=x[0];
		for (int i=1;i<x.length;i++) {
			int gcd = gcd(tmp,x[i]);
			tmp = tmp*x[i]/gcd;
		}
		return tmp;
	}
}

@@ -32,16 +32,99 @@
 cdLcm %7B%0A
+%09public static long gcd(long x, long y) %7Bif (y==0L) %7Breturn x;%7Dreturn gcd(y,x%25y);%7D%0A
 %09public 
@@ -350,10 +350,170 @@
 tmp;%0A%09%7D%0A
+%09public static long lcm(long... x) %7B%0A%09%09long tmp=x%5B0%5D;%0A%09%09for (int i=1;i%3Cx.length;i++) %7B%0A%09%09%09long gcd = gcd(tmp,x%5Bi%5D);%0A%09%09%09tmp = tmp*x%5Bi%5D/gcd;%0A%09%09%7D%0A%09%09return tmp;%0A%09%7D%0A
 %7D%0A

add overload versions of methods gcd and lcm