In the following program, for example, r
's value is 5.0
before doubling_time
has been entered, r
's value
is 10.0
as doubling_time
is executed, and r
's value
is 5.0
after the execution of doubling_time
.
#include#include /* Define doubling_time first */ double doubling_time (double r) { return log (2.0) / log (1.0 + r / 100.0); } /* Then, define main */ main ( ) { double r = 5.0; printf ("The value of r is %f.\n", r); printf ("The doubling time at twice that rate is %f.\n", doubling_time (r + r)); printf ("The value of r is still %f.\n", r); } --- Result --- The value of r is 5.000000. The doubling time at twice that rate is 7.272541. The value of r is still 5.000000.