최대공약수

int gcd(int a, int b)

{

return a%b ? gcd(b, a%b) : b;

}


최소공배수

a*b/gcd(a,b)

'C++' 카테고리의 다른 글

자리수 표현  (0) 2017.01.13

+ Recent posts