Related Articles
exp() function C++
• Difficulty Level : Basic
• Last Updated : 22 Jul, 2020

The exp() function in C++ returns the exponential (Euler’s number) e (or 2.71828) raised to the given argument.

Syntax for returning exponential e:
result=exp()

Parameter:
The function can take any value i.e, positive, negative or zero in its parameter and returns result in int, double or float or long double.

Return Value:
The exp() function returns the value in the range of [0, inf].

Error:
It shows error when we pass more then one argument in exp function

Application:
Given below is an example of application of exp() function

 #include using namespace std;  // function to explain use of exp() functiondouble application(double x){    double result = exp(x);    cout << "exp(x) = " << result << endl;    return result;}  // driver programint main(){    double x = 10;    cout << application(x);    return 0;}

Output:

exp(x) = 22026.5


Applications of e (mathematical constant):

• Compound Interest : An account that starts at \$1 and offers an annual interest rate of R will, after t years, yield eRt dollars with continuous compounding (Here R is the decimal equivalent of the rate of interest expressed as a percentage, so for 5% interest, R = 5/100 = 0.05)
• Value of below expression is e.
• The probability that a gambler never wins if he/she tries million times in a game where chances of winning in every trial is one by million is close to 1/e.
• The number e is the sum of the infinite series

Source : Wiki

Want to learn from the best curated videos and practice problems, check out the C++ Foundation Course for Basic to Advanced C++ and C++ STL Course for foundation plus STL.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.
My Personal Notes arrow_drop_up