You are here

pow function in C

pow function returns x raised to the power y, where x and y are variables of the double data type.

Declaration: double pow(double, double);

Function pow in C language

#include <stdio.h>
#include <math.h>

int main()
{
  double c, d, result;

  printf("Enter c and d to calculate c^d\n");
  scanf("%lf%lf", &c, &d);

  result = pow(c, d);

  printf("%.2lf raised to %.2lf = %.2lf\n", c, d, result);

  return 0;
}

Output of program:
pow math.h c programming

Share this