#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int main(){ /* 从键盘输入两个正整数, 求这两个正整数的最小公倍数和最大公约,并输出。 输入包括一行。 两个以空格分开的正整数。 */ int m , n; scanf("%d %d" , &m , &n); if( m < n){ int t = m ; m = n ; n = t; } int count = m *n; int temp; while(n!=0){ temp = m % n; m = n; n = temp; } printf("%d %d\n" , count/m , m); return 0; } |
Double click to view unformatted code.