Linear Diphotine Equation

In this equation, we make an equation in terms of x and y and we input a,b, and c in which a is the coefficient of x, b is the coefficient of y and c is a term that is equal to it

ax+by = c

This helps us to determine whether there is any possible solutions to this equation.

Let us talk about the process. we take gcd of a and b. if gcd divides (ax+by) it will also divide the c. therefore this is how algo works.

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
    if(a==0)
        return b;
    if(b==0)
        return a;
    if(a==b)
        return a;
    if(a>b)
        return gcd(a%b,b);
    return gcd(a,b%a);
}

int main() {
    // your code goes here
    int a,b,c;
    cin >>a >> b >> c;
    int x = gcd(a,b);
    int y = c%x;
    if(y==0)
    {
        cout<<"yes"<<endl;
    }
    else
    {
        cout<<"no"<<endl;
    }


    return 0;
}