Latest web development tutorials

C library functions - pow ()

C standard library - <math.h> C standard library - <math.h>

description

C library functionsdouble pow (double x, double y ) Returns xto the powery,ie x y.

statement

Here is () statement pow function.

double pow(double x, double y)

parameter

  • x - represents the quota of the floating-point value.
  • y - the floating-point value representing the index.

return value

The results of this function returns x raised to the power of y.

Examples

The following example demonstrates the pow () function is used.

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

int main ()
{
   printf("值 8.0 ^ 3 = %lf\n", pow(8.0, 3));

   printf("值 3.05 ^ 1.98 = %lf", pow(3.05, 1.98));
   
   return(0);
}

Let's compile and run the above program, which will result in the following:

值 8.0 ^ 3 = 512.000000
值 3.05 ^ 1.98 = 9.097324

C standard library - <math.h> C standard library - <math.h>