解题思路:
注意事项:
参考代码:public class Main {
private static int gongyueshu(int x,int y)
{
int z = y;
while(x%y!=0)
{
z = x%y;
x = y;
y = z;
}
return z;
}
private static int gongbeishu(int x,int y)
{
int s=x*y/gongyueshu(x,y);
return s;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
int y=sc.nextInt();
System.out.print(gongyueshu(x,y)+" "+gongbeishu(x,y));
}
}
0.0分
0 人评分