最大公约数,最小公倍数

来源:互联网 发布:js转义html的特殊字符 编辑:程序博客网 时间:2024/05/29 09:20
179.#include<iostream>
180.using namespace std;
181.int main()
182.{int a,b,c,d,e;
183.cin>>a>>b;
184.if(a<b)
185.{
186.e=a;
187.a=b;
188.b=e;
189.}
190.c=a*b;
191.while(b!=0)
192.{d=a%b;
193.a=b;
194.b=d;
195.}
196.cout<<"最大公倍数="<<a<<endl;
197.cout<<"最小公倍数="<<c/a<<endl;
198.return 0;
199.}