I am getting the corrrect answer but time limit is getting exceeded …please help
Program
#include
using namespace std;
int main()
{
int t,a,b,c;
cin>>t;
for(int j=0;j<t;j++)
{
cin>>a>>b>>c;
int ab=min(a,b);
int gcd=1;
for(int i=1;i<=ab;i++)
{
if(a%i==0 && b%i==0)
gcd=max(gcd,i);
}
if(c%gcd==0)
{
cout<<“Case “<<j+1<<”: Yes”<<endl;
}
else
{
cout<<“Case “<<j+1<<”: No”<<endl;
}
}
return 0;
}