ax+by=c has an integer solution if and only if d∣c where d=gcd(a,b); when it does, and (x0,y0) is one solution, every integer solution is exactly x=x0+dbt,y=y0−dat(t∈Z).
Why is it true?
It completely closes the problem: one divisibility check decides solvability, and once you have any single solution, a one-parameter family via t hands you every other solution — no guessing required.
Proof sketch
(⇒) If (x,y) is an integer solution, then d=gcd(a,b) divides both ax and by, hence divides ax+by=c. So d∣c is necessary.
(⇐) Suppose d∣c, say c=de. By Bézout's identity there exist u0,v0 with au0+bv0=d. Multiplying by e gives a(u0e)+b(v0e)=de=c, so (x0,y0)=(u0e,v0e) is an integer solution. This proves solvability.
Now fix any solution (x0,y0) and let (x,y) be any other solution. Subtracting ax0+by0=c from ax+by=c gives a(x−x0)+b(y−y0)=0, i.e. a(x−x0)=−b(y−y0). Dividing through by d: da(x−x0)=−db(y−y0), and since gcd(a/d,b/d)=1, the factor db must divide x−x0 (a standard consequence of coprimality: if p∣mn and gcd(p,m)=1 then p∣n). So x−x0=dbt for some integer t, and substituting back gives y−y0=−dat.
Conversely, for any integer t, substituting x=x0+dbt,y=y0−dat into ax+by gives ax0+by0+t(dab−dab)=c+0=c, confirming every such pair is indeed a solution. Hence the solution set is exactly x=x0+dbt,y=y0−dat(t∈Z).