最大公约数和最小公倍数

#include<iostream>
using namespace std;
int main()   /*  辗转相除法求最大公约数 */
{
   int m, n, a, b, t, c;
   cout<<"Input two integer numbers:"<<endl;
   cin>>a>>b;
   m=a;   n=b;
   while(b!=0)  /* 余数不为0,继续相除,直到余数为0 */
   {
	   c=a%b;
	   a=b;
	   b=c;
   }
   cout<<"The largest common divisor:"<<a<<endl;
   cout<<"The least common multiple:"<< m*n/a<<endl;
   return 0;
}

点赞