最大公约数与最小公倍数 发表于 2025-11-26 方法:辗转相除法原理:矩形不断切割一、最大数公约数int a,b,t; while(b!=0){ t =a%b; a=b; b=t; } int gcd(a,b)=b;//结果为b 二、最小公倍数int lcm=a*b/gcd(a,b);