Home >>C Math Functions >C math exp() function
The C math double exp(double x) functionis used to return the value of e(exponential) raised to the xth power. It takes a single argument and returns the value in type double. This function is defined in <math.h> header file.
Syntax:double exp( double arg );
x − It is the floating point value.
Here is an example of exp() function:
#include <stdio.h>
#include <math.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);
}
#include <stdio.h>
#include <math.h>
int main () {
double x = 10;
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);
}