Header file:
math.h
Synopsis:
double exp(double x);
Description:
Returns the value of e raised to the power of x.
exp function C example:
#include<stdio.h>
#include<math.h>
int main() {
double x, res;
printf("Enter your input:");
scanf("%lf", &x);
res = exp(x);
printf("Exponential function of e^%lf is %lf\n", x, res);
return 0;
}
#include<math.h>
int main() {
double x, res;
printf("Enter your input:");
scanf("%lf", &x);
res = exp(x);
printf("Exponential function of e^%lf is %lf\n", x, res);
return 0;
}
Output:
jp@jp-VirtualBox:~/cpgms/math$ gcc exp.c -lm
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:5
Exponential function of e^5.000000 is 148.413159
jp@jp-VirtualBox:~/cpgms/math$ ./a.out
Enter your input:5
Exponential function of e^5.000000 is 148.413159
No comments:
Post a Comment