c# a loop or something like that
I have a big problem with creating a code in c#.

This is the problem:

Constants:
a, b, c, d
I have a lot of variables but only this ones are interconnected:
x, y, z

For first iteration 1 have:

    x1 = [value from other variables];
    y1 = x1 + a;
    z1 = y1 + x1 + b;
    condition |c - z1| < d; 
    if it is true the the program calculates the other elements (from this point I know the job), but if the condition is false we have something like this:

    x2 = x1 + e;
    y2 = x2 + a;
    z2 = y2 + x2 + b;
    condition |c - z2| < d; 
    
    again, if false:
    x3 = x2 + e;
    y3 = x3 + a;
    z3 = y3 + x3 + b;
    condition |c - z3| < d; 

and so on until the condition is met.
I am new to c# so my do...while loops are not that good. 

    ϕ01 = (Math.Asin(L / R)) / 2;
    X01 = R * Math.Sin(2 * ϕ01) * Math.Cos(ϕ01);
    L01 = X01*(1 + (Math.Pow(Math.Tan(ϕ01), 2)) / 10 - (Math.Pow(Math.Tan(ϕ01), 4)) / 72 + (Math.Pow(Math.Tan(ϕ01), 6)) / 208);
    if ((Math.Abs(L01 - L)) < (0.003 * Math.Sqrt(L)))
    {
    X0 = X01; ϕ0 = ϕ01;
    }
    ϕ02 = ϕ01 * (L / L01);
    X02 = R * Math.Sin(2 * ϕ02) * Math.Cos(ϕ02);
    L02 = X02 * (1 + (Math.Pow(Math.Tan(ϕ02), 2)) / 10 - (Math.Pow(Math.Tan(ϕ02), 4)) / 72 + (Math.Pow(Math.Tan(ϕ02), 6)) / 208);
    if ((Math.Abs(L02 - L)) < (0.003 * Math.Sqrt(L)))

Thank for your help.
c# a loop or something like that
===

I have a big problem with creating a code in c#.

This is the problem:

Constants:
a, b, c, d
I have a lot of variables but only this ones are interconnected:
x, y, z

For first iteration 1 have:

    x1 = [value from other variables];
    y1 = x1 + a;
    z1 = y1 + x1 + b;
    condition |c - z1| < d; 
    if it is true the the program calculates the other elements (from this point I know the job), but if the condition is false we have something like this:

    x2 = x1 + e;
    y2 = x2 + a;
    z2 = y2 + x2 + b;
    condition |c - z2| < d; 
    
    again, if false:
    x3 = x2 + e;
    y3 = x3 + a;
    z3 = y3 + x3 + b;
    condition |c - z3| < d; 

and so on until the condition is met.
I am new to c# so my do...while loops are not that good. 

    ϕ01 = (Math.Asin(L / R)) / 2;
    X01 = R * Math.Sin(2 * ϕ01) * Math.Cos(ϕ01);
    L01 = X01*(1 + (Math.Pow(Math.Tan(ϕ01), 2)) / 10 - (Math.Pow(Math.Tan(ϕ01), 4)) / 72 + (Math.Pow(Math.Tan(ϕ01), 6)) / 208);
    if ((Math.Abs(L01 - L)) < (0.003 * Math.Sqrt(L)))
    {
    X0 = X01; ϕ0 = ϕ01;
    }
    ϕ02 = ϕ01 * (L / L01);
    X02 = R * Math.Sin(2 * ϕ02) * Math.Cos(ϕ02);
    L02 = X02 * (1 + (Math.Pow(Math.Tan(ϕ02), 2)) / 10 - (Math.Pow(Math.Tan(ϕ02), 4)) / 72 + (Math.Pow(Math.Tan(ϕ02), 6)) / 208);
    if ((Math.Abs(L02 - L)) < (0.003 * Math.Sqrt(L)))

Thank for your help.