# include # include void plotter ( int n, float a, float b ); float f1 ( float x ); float f2 ( float x ); int main ( ) { float a; float b; int n; float pi = 3.14159265; n = 25; a = 0.0; b = 2.0 * pi; plotter ( n, a, b ); return 0; } void plotter ( int n, float a, float b ) { float dx; float fx; int i; float x; dx = ( b - a ) / ( float ) ( n - 1 ); x = a; for ( i = 0; i < n; i++ ) { fx = f2 ( x ); printf ( "%2i %10g %10g\n", i, x, fx ); x = x + dx; } return; } float f1 ( float x ) { float value; value = sin ( x ); return value; } float f2 (float x ) { float value; value = x * ( 1 - x ) * ( 2 - x ); return value; }