public class Maxyue {
static int yueshu (int a,int b) throws MyException {
int temp,yue=1;
if(a<0 || b<0 ) throw new MyException("should be positive");
if(a>b){
temp = b;
b=a;
a=temp;
}
while(yue!=0)
{
yue = b%a;
b=a;
a=yue;
}
return b;
}
static int beishu(int a,int b) {
try {
int yue = yueshu(a,b);
//int max = a>b?a:b;
if(yue>1)
return a*b/yue;
else return a*b;
}catch (MyException e){
return 1;
}
}
public static void main(String args[]) {
int p1=10,p2=15;
try{
int pp=yueshu(p1,p2);
int ppp = beishu(p1,p2);
System.out.print(pp);
System.out.print("\n");
System.out.print(ppp);
}catch (MyException e) {
System.out.print(e);
}
}
}
static int yueshu (int a,int b) throws MyException {
int temp,yue=1;
if(a<0 || b<0 ) throw new MyException("should be positive");
if(a>b){
temp = b;
b=a;
a=temp;
}
while(yue!=0)
{
yue = b%a;
b=a;
a=yue;
}
return b;
}
static int beishu(int a,int b) {
try {
int yue = yueshu(a,b);
//int max = a>b?a:b;
if(yue>1)
return a*b/yue;
else return a*b;
}catch (MyException e){
return 1;
}
}
public static void main(String args[]) {
int p1=10,p2=15;
try{
int pp=yueshu(p1,p2);
int ppp = beishu(p1,p2);
System.out.print(pp);
System.out.print("\n");
System.out.print(ppp);
}catch (MyException e) {
System.out.print(e);
}
}
}