Algorithm for expfn function:
The algorithm for expfn function is as shown:
- receives the value of x as the input argument.
- Prints the value of exp(x).
- assigns a random value for the number of terms n (an alternative technique would be to prompt the user for this).
- Call a subfunction appex to find an estimated value of exp(x) by using a series with n terms.
- Prints this estimated value.