Facebook Page Twitter Page LinkedIn Page
× C Tutorial C Resources


The C math pow() function is used to return the base raise to the power of exponent.

Syntax

double pow(double base, double exponent);
float powf(float base, float exponent);
long double powl(long double base, long double exponent);

Parameters

base Specify the base.
exponent Specify the exponent.

Return Value

Returns the base raise to the power of exponent.

Example:

In the below example, pow() function is used to calculate the base raised to the power of exponent.

#include <stdio.h>
#include <math.h>
 
int main (){
  printf("%lf\n", pow(2, 3));
  printf("%lf\n", pow(2.3, 4)); 
  return 0;
}

The output of the above code will be:

8.000000
27.984100

❮ C <math.h> Library