We calculate the LCM and GCD of a and b
In C++, we don't have LCM so we use a * b / GCD(a, b)
Code:
```
#include<bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
//Calculate GCD and LCM
int gcd = __gcd(a, b);
int lcm = a * b / __gcd(a, b);
//Then print GCD and LCM
cout << gcd << " " << lcm;
return 0;
}
```