The exp() function defined in the math.h header file. It helps to returns e raised to the power of the given argument. The value of e is equal to 2.71828.
double exp( double argument ); #where argument should be a double value
The exp() function takes a single parameter. The exp(x) in C programming is equal to the mathematical representation of ex.
Parameter | Description | Required / Optional |
---|---|---|
argument | a double value | Required |
The return value of exp() function is the exponential value of giving argument it should be a double value.
Input | Return Value |
---|---|
double value | exponential value in double |
#include <stdio.h>
#include <math.h>
int main() {
double k = 12.0, output;
output = exp(k);
printf("The exponential value of %.2lf = %.2lf", k, output);
return 0;
}
Output:
The exponential value of 12.00 = 162754.79
#include <stdio.h>
#include <math.h>
int main () {
double k = 0;
printf("Exponential value of %lf is %lf\n", k, exp(k));
printf("Exponential value of %lf is %lf\n", k+1, exp(k+1));
printf("Exponential value of %lf is %lf\n", k+2, exp(k+2));
return(0);
}
Output:
Exponential value of 0.000000 is 1.000000 Exponential value of 1.000000 is 2.718282 Exponential value of 2.000000 is 7.389056