C library functions - exp ()
description
The value of C library functionsdouble exp (double x) Returns eraised to the power ofx.
statement
Here is exp () function's declaration.
double exp(double x)
parameter
- x - floating-point value.
return value
This function returns e raised to the power of x.
Examples
The following example demonstrates the exp () function is used.
#include <stdio.h> #include <math.h> int main () { double x = 0; printf("e 的 %lf 次幂是 %lf\n", x, exp(x)); printf("e 的 %lf 次幂是 %lf\n", x+1, exp(x+1)); printf("e 的 %lf 次幂是 %lf\n", x+2, exp(x+2)); return(0); }
Let's compile and run the above program, which will result in the following:
e 的 0.000000 次幂是 1.000000 e 的 1.000000 次幂是 2.718282 e 的 2.000000 次幂是 7.389056