All pastes #615658 Raw Edit

Something

public c v1 · immutable
·published 2007-07-12 07:13 UTC
rendered paste body
#include <stdio.h>#include <math.h>double iterate ( double x, double *a, double *b );int main ( ){        double a, b, c=0.7, d=0;    int x = 0;        a = 0;    b = 1;    while ( a + b >= 1 )    {        printf ( "a + b should be less than 1\n" );         while ( a <= 0 )        {              printf ( "Value for a must be larger than 0\n" );              printf ( "Enter value for a: " );              scanf ( "%lf", &a );        }        while ( b >= 1 )        {              printf ( "Value for b must be smaller than 1\n" );              printf ( "Enter value for b: " );              scanf ( "%lf", &b );        }        printf ( "%f\n", a+b );    }       a = 0.5;    b = 0.25;    while ( ( round ( d ) != round ( c ) ) || x == 1000 )    {           d = c;          c = iterate ( c , &a, &b );          printf ( "Current c: %f\n", c );          ++x;    }    printf ( "You entered %.15f\n", c );    system("PAUSE");    return 0;        }double iterate ( double x, double *a, double *b ){    return x-(pow(*a, x)+pow(*b, x )- 1)/(log(*a)*pow(*a, x)+log(*b)*pow(*b, x));   }