You are here

pow function

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

Declaration: double pow(double, double);

C programming code for pow

  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.   double c, d, result;
  7.  
  8.   printf("Enter c and d to calculate c^d\n");
  9.   scanf("%lf%lf", &c, &d);
  10.  
  11.   result = pow(c, d);
  12.  
  13.   printf("%.2lf raised to %.2lf = %.2lf\n", c, d, result);
  14.  
  15.   return 0;
  16. }

Output of program:
pow math.h c programming