#include<iostream>
using namespace std;
int fun1(int a,int b)
{
int x,y,t;
if(a>b)
{
x=a;
y=b;
}
else
x=b;
y=a;
while(x%y!=0)
{
x=y;
t=x%y;
y=t;
}
return y;
}
int fun2(int a,int b)
{
int t;
if(a>b)
t=a;
else t=b;
while(t%a!=t%b)
{
t++;
}
return t;
}
int main()
{
int a,b;
cout<<"请输入两个整数"<<endl;
while(1<2)
{
cin>>a>>b;
cout<<"最大公约数为"<<fun1(a,b)<<endl;
cout<<"最小公倍数为"<<fun2(a,b)<<endl;
}
return 0;
}
using namespace std;
int fun1(int a,int b)
{
int x,y,t;
if(a>b)
{
x=a;
y=b;
}
else
x=b;
y=a;
while(x%y!=0)
{
x=y;
t=x%y;
y=t;
}
return y;
}
int fun2(int a,int b)
{
int t;
if(a>b)
t=a;
else t=b;
while(t%a!=t%b)
{
t++;
}
return t;
}
int main()
{
int a,b;
cout<<"请输入两个整数"<<endl;
while(1<2)
{
cin>>a>>b;
cout<<"最大公约数为"<<fun1(a,b)<<endl;
cout<<"最小公倍数为"<<fun2(a,b)<<endl;
}
return 0;
}