Add and Divide - starter 13 (div 3)

I was attempting this question I found out , all we have to use GCD for this question compare whether 1 or not ,if the gcd of a and b is 1 then print “no” otherwise print “yes”.
my code as follows:

ll a, b;

    cin >> a >> b;

    ll sum = __gcd(a, b);

    cout << sum << endl;


        cout<<"no"<<endl ;

when i submitted this code my first TC was correct but other three went wrong help me out ,if you can, please give me other test cases ,i went through other test cases but not able to find out my mistake

my submission link : Solution: 51717108 | CodeChef

6 3
1 Like

take this case :
gcd(a,b)=2 , but answer for this “NO”
Basically what we can say if all prime factors of ‘a’ are aslo prime factors of ‘b’, then it is “YES”

1 Like

What does your program output for a = 10 , b = 6 ? The expected answer should be “NO”.

1 Like