I need to find XY of the 3rd tip of the triangle.
I have X1 and Y1, X2 and Y2 as well as I know the distance C

I need a formula that I can use in a code to do the calculations. Triangle is always at a right angle, and I always know X1Y1, X2Y2 and C. On the picture greyed-out parts I dont know. Triangle will not always be 'flat' i.e. X1 != X2. Also C may be positive or negative.
I tried looking at other answers like How to find coordinates of 3rd vertex of a right angled triangle when everything else is known? but I am not really good at geometry (as you can probably tell) and I have no idea where do m and n come from. So a simple answer for a simple programmer would be ideal :).
Algorithm:
Step 1. Form $(X_2 - X_1, \, Y_2-Y_1)$ which is the vector from the first vertex to the second. It spans the edge of the triangle from vertex $1$ to vertex $2$.
Step 2. Change it into $\epsilon \, (Y_1 - Y_2, \, X_2 - X_1)$ which is the vector orthogonal to the vector from step 1. This new vector is parallel to the edge from vertex $2$ to vertex $3$. However, it doesn't have the proper length. The parameter $\epsilon = \pm 1$ because the vector can point "up" or "down" so there will be two solutions to your problem: vertex $3$ can be on one or the other side of the edge from vertex $1$ to vertex $2$.
Step 3. Calculate the length of the vector from step 2, which is $$L = \sqrt{(X_2 - X_1)^2 + (Y_2 - Y_1)^2}$$
Step 4. Form the new vector $$\epsilon \,\left(\frac{Y_1 - Y_2}{L}, \, \frac{X_2 - X_1}{L}\right)$$ which is obtained by dividing the vector from step 2 by its length. This is a vector of unit length and parallel to the vector from step 2.
Step 5. Multiply the vector from step 4 by $C$ and obtain the vector $$\epsilon \,\left(\frac{C \, (Y_1 - Y_2)}{L}, \, \frac{C\, (X_2 - X_1)}{L}\right)$$ The latter is a vector parallel to the edge between vertex $2$ and vertex $3$ and has length exactly $C$.
Step 6. The coordinates of vertex $3$ are $$(X_3, Y_3) = (X_2, Y_2) \pm \, \left(\frac{C \, (Y_1 - Y_2)}{L}, \, \frac{C\, (X_2 - X_1)}{L}\right)$$
Step 7. The final detailed formula is $$\big(\, X_3, \, Y_3 \,\big) \, = \, \left(\, X_2 \pm \frac{C \, (Y_1 - Y_2)}{L}\, , \,\, Y_2 \pm \frac{C \, (X_2 - X_1)}{L}\right)$$ where the parameter $L$ is equal to $$L = \sqrt{(X_2 - X_1)^2 + (Y_2 - Y_1)^2}$$