C exp()

C exp() Prototype

The function prototype of exp() is:

double exp(double x);

The ex in mathematics is equal to exp(x) in C programming.


exp() Parameters

The exp() takes a single argument.

  • x - a double value.

exp() Return Value

The exp() function returns a double value.


The exp() function is defined in the <math.h> header file.


Example: C exp() function

#include <math.h>
#include <stdio.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
Did you find this article helpful?