int m, n; //Two integers
int mmd; //Greatest common divisor
int mmu; //Least common multiple
while((n%=m)&&(m%=n)); //One line of code refers to this The most important line in a row
mmu=n+m;//The least common multiple, after the euclidean division, one of m and n must be 0, and the one that is not zero is the least common multiple
mmd=(n*m)/mmu;//Maximum The common divisor is equal to the lowest common multiple of two numbers multiplied together.
Here is the code that works:
#include <stdio.h>
int main() {
int m,n;
int m1,n1,rem;
int mmd,mmu;
scanf ("%d%d", &m, &n);
m1=m;
n1=n;
if(n1)
while((m1 %= n1) && (n1 %= m1));
mmu = m1+n1;
mmd = m*n/mmu;
printf ("最大公约数:%d\n", mmu);
printf ("最小公倍数:%d", mmd);
return 0;
}