非线性方程求根

非线性方程求根_第1张图片

 

int main () {
    double a, c;
    double x = 0, y = 100,m;
    int b;
    scanf("%lf%d%lf",&a,&b,&c);
    while( y - x > 1e-5) {
        printf("%f ", y);
        m = x + (y-x)/2;
        double f = a;
        for ( int i = 0; i < b; i++ ) f += f*m/100-c;
            if (f<0) x = m; else y = m;
    }
    printf("%f\n", y);

    system("PAUSE");
    return 0;
}

 

转载于:https://www.cnblogs.com/tsubasa/archive/2012/12/12/2815511.html

你可能感兴趣的:(非线性方程求根)