Easy Tutorial
❮ C Exercise Example37 C Function Putc ❯

C Library Function - pow()

C Standard Library - <math.h>

Description

The C library function double pow(double x, double y) returns the value of x raised to the power of y, i.e., x^y.

Declaration

Following is the declaration for the pow() function.

double pow(double x, double y)

Parameters

Return Value

This function returns the result of raising x to the power of y.

Example

The following example demonstrates the use of the pow() function.

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

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

   printf("Value of 3.05 ^ 1.98 = %lf", pow(3.05, 1.98));

   return(0);
}

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

Value of 8.0 ^ 3 = 512.000000
Value of 3.05 ^ 1.98 = 9.097324

C Standard Library - <math.h>

❮ C Exercise Example37 C Function Putc ❯