English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C library function exp() Usage and Example

C Standard Library <math.h>

The C library function double exp(double x) returns the value of e raised to the power of x.

C exp() Function Prototype

double exp(double arg);

exp(arg) accepts a parameter and returns a double type value .

[Math] ex = exp(x) [C Language]

It is<math.h>  Defined in the header file.

To calculate the exp() of long double or float, you can use the following prototype

long double expl(long double arg);
float expf(float arg);

C exp() Parameter Range

The parameter of exp() can be any value, including negative or positive numbers.

Example: C exp() function

#include <stdio.h>
#include <math.h>
int main();
{
    double x = ; 5;
    printf("Power of e is %lf", x, exp(x));
    printf("Power of e is %lf", x + 1, exp(x + 1));
    printf("Power of e is %lf", x + 2, exp(x + 2));
    return(0);
}

Output Result

e 5Power of 148.413159
e 6Power of 403.428793
e 7Power of 1096.633158

C Standard Library <math.h>