English

Write short note on pow() function in C++.

Advertisements

Question

Write short note on pow() function in C++.

Short/Brief Note
Advertisements

Solution

The pow() function returns base raised to the power of exponent. If any argument passed to pow() is long double, the return type is promoted to long double. If not, the return type is double. The pow() function takes two arguments:

  1. base – the base value
  2. exponent – exponent of the base

Example:
cout << pow(5, 2);

Output:
25

shaalaa.com
C++ Header Files and Built-in Functions
  Is there an error in this question or solution?
Chapter 11: Functions - Evaluation - Section - C [Page 205]
Advertisements
Share
Notifications



      Forgot password?
Use app×