GCD и LCM в C
long long gcd(long long int a, long long int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
long long lcm(ll int a, ll int b)
{
return (a / gcd(a, b)) * b;
}
// there is a math formula used in this code which you can search up about,
// but you can just use it as it is.
Xixika