What is exp in c programming?
exp function calculates exponential value of a given number.
It is defined in math.h
header file.
Prototype
double exp(double m);
Parameters
exp function takes double type value as input parameter.
Return values
exp function returns exponential value of a given number.
Example program for exp in c
#include<stdio.h>
#include<math.h>
int main()
{
double a=2.0;
printf("The exponential value is %lf \n",exp(a));
return 0;
}
While using gcc use below command to add math header.
gcc file_name.c -lm
Code explanation
exp function is called by passing the input value. The exponential value is printed onto the console.
Difference between exp and pow in c
exp function is used to calculate the exponential value of a given number. pow is used to calculate the power of a number raised to the base value.
exp function takes one parameter. pow function takes two parameters.
Prototypes are as follows
double exp(double value1);
double pow(double value1,double value2);
exp in c | pow in c |
Used to calculate exponential value of a given number. | Used to calculate power of a number raised to the base value. |
double exp(double value1); | double pow(double value1,double value2); |
Difference between exp and sqrt in c
exp function is used to calculate the exponential value of a given number. sqrt function is used to calculate the square root of a given number.
Prototypes are as follows
double exp(double value1);
double sqrt(double value1);
exp in c | sqrt in c |
Used to calculate exponential value of a given number. | Used to calculate square root of a given number. |
double exp(double value1); | double sqrt(double value1); |
People also ask for
What is exp in c?
exp function is used to calculate the exponential value of a given number. It is defined in math.h header file.