Question: CS-2423 C Programming language ( PLEASE C PROGAM ONLY. AND A COMPLETE PROGRAM WITH THE OUTPUTS) NO C++, JAVA 1. (100 pts) Write a program

CS-2423 C Programming language ( PLEASE C PROGAM ONLY. AND A COMPLETE PROGRAM WITH THE OUTPUTS) NO C++, JAVA

1. (100 pts) Write a program that implements the following functions.

long factorial(int n)

double exponent(double x, int n)

The functions implemented should follow below guidelines

Factorial: Computes n! =n(n1). . .1

Exponent:

Computes the sum of first

n

terms of

e

x

using the following approximation.

f

(

x, n

) =

e

x

=

n

X

i

=0

x

i

i

!

=

x

0

0!

+

x

1

1!

+

x

2

2!

+

. . .

+

x

n

n

!

Read the value of

n

and

x

from the user and compute the first

n

terms of

e

x

using the function

exponent

. Print the result returned by the function and compare it with the value obtained

by calling the math library function

exp

. When you increase the value of

n

your result should

get closer to the result of

exp

.

Sample execution of the program is given below

Enter n and x

20 2.1

Approximation = 8.1753222282

Exact = 8.1661699126

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!