By | 05.11.2016

# Evaluate Exponential Series using Function

Write a C Program to Evaluate Exponential Series using Function. Here’s simple Program to Evaluate Exponential Series using Function in C Programming Language.

## Numbers in C

Normally, when we work with Numbers, we use primitive data types such as int, short, long, float and double, etc. The number data types, their possible values and number ranges have been explained while discussing C Data Types.

Here is source code of the C Program to Evaluate Exponential Series using Function. The C program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

### SOURCE CODE : :

```/*  C Program to Evaluate Exponential Series using Function  */

#include<stdio.h>
#include<math.h>

int factorial(int n)
{
int i,fact=1;
for(i=1;i<=n;i++)
fact=fact*i;
return fact;
}

int main()
{
double x, epwx=1, z, term;
int j, n, i;

printf("\nEnter the value for x : ") ;  //Example 4 5 6
scanf("%lf", &x) ;
printf("\nEnter the value for n : ") ;   //Example 10 20
scanf("%d", &n) ;

x = x * 3.14159 / 180 ;   //converting degree to radian
i=0;
z=exp(x);

for(i=1;i<=n;i=i+1)
{
term=pow(x,i)/factorial(i);
epwx=epwx+term;
}
printf("\nexp(x) is approximately %.15lf\n", epwx);
printf("\nexp(x) by default function is %.15lf\n", z);

return 0;
}```

### OUTPUT : :

```/*  C Program to Evaluate Exponential Series using Function  */

Enter the value for x : 4

Enter the value for n : 10

exp(x) is approximately 1.072307760120723

exp(x) by default function is 1.072307760120723

Process returned 0```

Above is the source code for C Program to Evaluate Exponential Seriesusing Function which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.

Article Rating
Category: C Programming Number Programs Tags:  