# Library Function exp in Math Class

## Library Function exp of math.h Header File in C

On this page we will discuss about library function exp in math class which is used in C.
The C header file math.h contains the standard math library functions that can be used for performing various mathematical operations. The exp function evaluates e (2.71828) raised to the power of the given argument and returns the output. ## Library Function exp of math.h Header File

In C programming language the exp function is included in math.h header file.

The range of input argument which is passed to exp function is not limited here as it can be any value from int to float or double but then has to be type casted into double type.

### Declaration of exp function

```double exp(double x)
```

### Parameters of exp function

The exp function accepts a single input argument  which is a double value.

ParameterDescription
double valueThis value of double function ranges from all positive to all negative numbers.

### Return value of exp function

The exp function returns a value in which is the result of exponent e to the argument x and it’s type is double.

ParameterReturn Value
Exponent e raised to power of argumentIt returns the value in double type..

### Implementation of Library Function math.h exp

#### Example 1:

The following code shows the use of exp function.

Run
```#include<stdio.h>
#include<conio.h>
int main() {
double x = 12.0, result;
result = exp(x);
printf("Exponential of %.2lf = %.2lf", x, result);
return 0;
}
```

#### Output:

```Enter the value of x to find e^x: 12
Exponential of 12.00 = 162754.79
```

#### Example 2:

Run
```#include<stdio.h>
#include<conio.h>
int main () {
double x = 0;
printf("The exponential value of %lf is %lf\n", x, exp(x));
printf("The exponential value of %lf is %lf\n", x+1, exp(x+1));
printf("The exponential value of %lf is %lf\n", x+2, exp(x+2));
return(0);
}
```

#### Output:

```The exponential value of 0.000000 is 1.000000
The exponential value of 1.000000 is 2.718282
The exponential value of 2.000000 is 7.389056
```

### Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

## Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others