/********************************** Compute the map x_{n+1} = x_n^2 ************************************/ //Include libraries #include #include main() { int i, n; double x_n, x_n1; FILE*fw = fopen( "map_x_sq.dat", "w" ); printf( "Enter the value of n: \t"); scanf( "%d", &n ); printf( "Enter the value of x0: \t"); scanf( "%lf", &x_n ); fprintf( fw, "%d\t%lf\n", 0, x_n ); for( i = 1; i <= n; i++ ) { x_n1 = x_n * x_n; x_n = x_n1; fprintf( fw, "%d\t%0.6lf\n", i, x_n ); } fclose(fw); }