The C exp function is one of the Math Functions, used to return E raised to the power of a given value or specified expression. Here, E is Euler’s number, and it is approximately equal to 2.71828. The basic syntax of the exp function in this C Programming is
double exp(double number);
C exp Function Example
The math exp Function allows you to find the 2.71828 raised to the power of a given value. In this program, We are going to find same and display the output.
#include <stdio.h> #include <math.h> int main() { printf("\n The Exponential Value of e power 0 = %.4f ", exp(0)); printf("\n The Exponential Value of e power 1 = %.4f ", exp(1)); printf("\n The Exponential Value of e power 5 = %.4f ", exp(5)); printf("\n The Exponential Value of e power 6.4 = %.4f ", exp(6.4)); printf("\n The Exponential Value of e power -9.32 = %.4f ", exp(-9.32)); printf("\n The Exponential Value of e power -10.34 = %.4f ", exp(-10.34)); return 0; }
exp Example 2
In this C Programming example, we are providing the user to enter their own value. Next, the program uses the exp function to find E raised to the power of the user-given number.
#include <stdio.h> #include <math.h> int main() { float number, expValue; printf(" Please Enter any Numeric Value : "); scanf("%f", &number); expValue = exp(number); printf("\n Exponential Value of e power %.2f = %.4f ", number, expValue); return 0; }
Please Enter any Numeric Value : 4.25
Exponential Value of e power 4.25 = 70.1054