You will be given two integers A, B. If A × B (product of A and B) is equal to LCM(A, B) then you ha…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
#include<iostream>
using namespace std;
int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
int main()
{
int n;
cin >> n;
int a, b;
for(int i=1; i<=n; i++)
{
cin >> a >> b;
if(gcd(a, b) == 1)
cout << "yes" << endl;
else
cout << "no" << endl;
}
return 0;
}
#include
using namespace std;
int main()
{
int num,i;
long long a,b,m,n,rem,div;
cin>>num;
for(i=0;i<num;i++)
{
cin>>a>>b;
m=a;
n=b;
while(n!=0)
{
rem=m%n;
m=n;
n=rem;
}
div=(ab)/m;
if(ab==div)
{
cout<<“yes”<<endl;
}
else
cout<<“no”<<endl;
}
}
what is the problem in this code??