### My issue

include

include

using namespace std;

int main() {

int t;

cin >> t;

while (t–) {

int x, y, k;

cin >> x >> y >> k;

```
for (int i = 1; i <= k; i++) {
int gcd = __gcd(x, y);
if (x > y) {
x = gcd;
y = (x * y) / gcd;
} else {
y = gcd;
x = (x * y) / gcd;
}
}
cout << (x + y) << endl;
}
return 0;
```

}

What’s the error in this code ? please help

### My code

```
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int x, y, k;
cin >> x >> y >> k;
for (int i = 1; i <= k; i++) {
int gcd = __gcd(x, y);
if (x > y) {
x = gcd;
y = (x * y) / gcd;
} else {
y = gcd;
x = (x * y) / gcd;
}
}
cout << (x + y) << endl;
}
return 0;
}
```

Problem Link: GCDLM Problem - CodeChef