Site icon Codeforcoding

exp function in C programming language

exp function in C programming language

Description

In C programming language,  exp function in C.  returns the value of e raised to the xth power.

exp() : In the C programming language, The exp() function calculates e raised to the power of x(given argument)

( calculate the exponential “e” to the xth power)

 

Declaration

The declaration of the exp() function in the C Language

double exp (double value);

Parameter or argument

the parameter of the exp() function is

x – This is  the floating point value

The argument for exp() can be any value, either positive or negative

Returns

The exp() function returns the result of e raised to the power of x

 

Required header

In the this Language, the required header of the exp()  is:

#include<math.h>

exp function in C

Example

The following example shows the usage of the exp function

#include <stdio.h>
#include <stdlib.h>

int main()
{
    double x=2.1,y=1;
    printf("exp value of %f is %f\n",x,exp(x));
    printf("exp value of %f is %f\n",y,exp(y));
    getch();
    return 0;
}

 

When the above program is compiled, it will produce the following result

exp value of 2.100000 is 8.166170

exp value of 1.000000 is 2.718282

 

Program 2

#include <stdio.h>
#include <math.h>
int main()
{
    double m,n;//diclare of local  variable
    printf("Enter the a value for find exponential :");
    //get input for calculate sinh
    scanf("%lf",&m);
   printf("Enter the a value for find exponential :");
    //get input for calculate sinh
    scanf("%lf",&n);
    printf("exp value of the %lf is: %lf\n",m,exp(m));
    printf("exp value of the %lf is: %lf",n,exp(n));
    getch();
    return 0;
}

When the above program is compiled, it will produce the following result

Enter a value for find exponential :2
Enter a value for find exponential :4
exp value of the 2.000000 is :7.389056
exp value of the 4.000000 is :54.598150

 

Similar functions

Other C programming language functions that are  similar to the cosine function

 

Suggested for you

pow() function in C language

trunc() function in C langue

sqrt() function in C language       

cosh function   in C  language                               

sinh function in C language

tanh function in C language

abs function in C language

floor function in C language

ceil function in C language

round function in C language

 

suggested for you

Function in C language

User defined function in C language

Arithmetic functions in C Language

String function in C language

 

 

cosh arithmetic function in C language with example
trunc function in C programming language
Exit mobile version