The following program uses a macro symbol,
MINIMUM_RETURN_RATE
, as well as global variables,
deposit_rate
and marginal_rate
:
#include/* Define MINIMUM_RETURN_RATE to be a macro */ #define MINIMUM_RETURN_RATE 2.5 /* Define deposit_rate and marginal_rate to be global variables */ double deposit_rate, marginal_rate; void display_analysis ( ) { double net_rate; net_rate = deposit_rate - deposit_rate * marginal_rate / 100.0; printf ("The net rate for your deposit is %f percent.\n", net_rate); printf ("The deviation from the acceptable rate is %f percent.\n", net_rate - MINIMUM_RETURN_RATE); } /* Then, define main */ main ( ) { scanf ("%lf%lf", &deposit_rate, &marginal_rate); display_analysis ( ); } --- Data --- 7.1 42.5 --- Result --- The net rate for your deposit is 4.082500 percent. The deviation from the acceptable rate is 1.582500 percent.