import java.util.Scanner;
public class Muitipie {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("input x :");
int x = in.nextInt();
System.out.print("input y :");
int y = in.nextInt();
int z = Method(x,y);
System.out.println("辗转相除法:");
System.out.println("divisor : "+z);
System.out.println("multiple : "+(x*y/z));
System.out.println("相减法:");
z = Subtraction(x,y);
System.out.println("divisor : "+z);
System.out.println("multiple : "+(x*y/z));
System.out.println("穷举法:");
z = divisor(x,y);
System.out.println("divisor : "+divisor(x,y));
z=multiple(x,y);
System.out.println("multiple : "+multiple(x,y));
}
//辗转相除法:返回公约数
public static int Method(int x,int y){
int a,b,c;
a=x;
b=y;
while(b!=0){
c=a%b;
a=b;
b=c;
}
return a;
}
//相减法
public static int Subtraction(int x,int y){
while(x!=y){
if(x>y){
x=x-y;
}
else{
y=y-x;
}
}
return x;
}
//穷举法 求公约数
public static int divisor(int x,int y){
int z;
for(z=x;z>0;z--){
if(x%z==0&&y%z==0){
break;
}
}
return z;
}
//求公倍数
public static int multiple(int x,int y){
int z;
for(z=x;;z++){
if(z%x==0&&z%y==0){
break;
}
}
return z;
}
}