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
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

6 months ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

6 months ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

6 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

9 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

1 year ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

1 year ago