Why it's showing wrong answer?

#include
using namespace std;
int main()
{
int t,i,A,B,x,y;
cin>>t;
for(i=0;i<t;i++)
{
cin>>A>>B;
x=A;
y=B;
while(A!=B)
{
if(A>B)
{
A=(A-B);
}
else
{
B=(B-A);
}
}
//output
cout<<A<<" "<<(x/A)*y<<endl;
}
return 0;
}

Hey @suvankar_20,
Please add the link to question and also the link to your submission so that the community can help.

Manan (@manani) :slight_smile:

Here is the link to your AC soln

1 Like