(yB-yA)/(xB-xA) = (yC - yA) / (xC-xA)
you just have to obtain xC
now, that is
xC = xA + ((yC - yA) * (xB-xA) / (yB-yA))
This is, assuming that yB
is different from yA
. If they are equal, then you have not solutions if yC
is different from yA
, and infinite solutions ( every xC
works) if yC=yA