Can we reach from point $b$ to point $c$ if we can always move right by $b$ and left by $a$ points? We are given the following integers $a\geq1,b\geq1$ and $c\geq1$.
I am standing on a real line at point $b$. I always can move right by $b$ points or move left by $a$ points. I want to find out if I can reach point $c$.

So we need to find if there exist integers $n1,n2$ such that $c-b=bn_1-an_2$.
This problem is from coding, but I couldn't find a necessary and sufficient condition to check whether we can reach the point $c$ from point $b$. I feel that we need to play with $\mathrm{mod}(b)$, $\mathrm{mod}(a)$, $\mathrm{mod}(b-a)$.

What you need is Bezout's lemma, which says that $\{ ax+by : a,b \in \mathbb{Z} \}=\{ ad : a \in \mathbb{Z} \}$ where $d$ is the GCD of $x$ and $y$. Therefore in your problem we need to know whether the GCD of $a$ and $b$ divides $c-b$. This reduces to whether it divides $c$, since it obviously divides $b$.
To finish your problem you need to deal with the nonnegativity constraint, but this is not a big deal. Once you have a solution at all, add a large enough multiple of $(a/\mathrm{gcd}(a,b),b/\mathrm{gcd}(a,b))$ to it that you have a nonnegative solution. (Or just use a multiple of $(a,b)$, if you don't care about having the smallest possible solution.)
