/* --------------------------------------------------------------------- // Figure 9.1: Functions, prototypes, and calls. // --------------------------------------------------------------------- */ #include "tools.h" #define MIN 10.5 #define MAX 87.0 double f (double y); /* Prototype for function f, defined below. */ double g (double y) { return( y * y + y ); } /* Definition of function g. */ void main (void) { double x, z; banner(); printf( "\n Enter a value of x between %.2f and %.2f: ", MIN, MAX ); scanf( "%lg", &x ); z = f( x ); printf( "\n The value of x * exp(x) is: %g \n", z ); printf( "\n The value of x * x + x is: %g \n", g( x ) ); bye(); } /* ------------------------------------------------------------------- */ /* -- Definition of function to calculate f = y * e to the power y. -- */ double f (double y) { return y * exp(y) ; }