![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnXMEX%2FbtrOjz8gWAd%2FCipg0wZ1lPru2P9vXfKcuK%2Fimg.png)
[백준][C++]#2609 최대공약수와 최대공배수
#include using namespace std; int GCD(int a, int b) { while (true) { int temp = a % b; if (temp != 0) { a = b; b = temp; } else return b; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b, gcd, lcm; cin >> a >> b; gcd = a > b ? GCD(a, b) : GCD(b, a); cout