GCD_LCM problem

//The below case works with the test case given on the problem page and other self made ones as //well. But I get wrong answer when I submit. Problem Code: FLOW016
#include
using namespace std;

int minfunc(int num1, int num2)
{
if (num1 == num2){
return num1;
}
else if (num1 > num2)
{
return num2;
}
else{
return num1;
}
}

int main() {
int T{};
cin >> T;
for (int i = 0; i < T; i++){
int A{};
int B{};
int GCD{1};
cin >> A;
cin >> B;
if (A == B)
{
GCD = A;
}
int min = minfunc(A,B);
for(int j = min; j <= min; j–){
if (A%j == 0 && B%j == 0)
{
GCD = j;
break;
}
}
int LCM = A*B / GCD;
cout << GCD << " " << LCM << endl;

}
return 0;

}