#include <stdio.h> int main() { int m, n,mcd, t, r, gcd; scanf("%d %d", &m, &n); gcd=m*n; if(m<n) { t = m; m = n; n = t; } while(n!=0) { r = m % n; m = n; n = r; } printf("%d\n",m); printf("%d\n",gcd/m); return 0; }
C/C++训练1---最大公约数与最小公倍数
最新推荐文章于 2024-05-20 20:16:31 发布