#include<stdio.h> int main(){ int a,b,bei,yue; scanf("%d%d",&a,&b); if(a<b){ int t; t = a; a =b; b=t; } yue =gcd(a,b); bei= a*b/yue; printf("%d %d",bei,yue); } int gcd(int n,int m){ if(m==0) return n; else return gcd(m,n%m); } |
Double click to view unformatted code.