pow function(Power) in C Language – example and detail

In the C Programming Language, the pow characteristic returns x raised to the strength of y.

Syntax

The syntax for the pow characteristic in the C Language is:

double pow(double x, double y);

Parameters or Arguments

x A fee used in the calculation the place x is raised to the power of y. y A fee used in the calculation where x is raised to the energy of y.

Returns

The pow function returns x raised to the power of y. If x is bad and y is not an integer value, the pow function will return a area error.

Required Header

In the C Language, the required header for the pow characteristic is:

#include <math.h>

Applies To

In the C Language, the pow function can be used in the following versions:

ANSI/ISO 9899-1990

pow Example

/* Example using pow by TechOnTheNet.com */

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

int main(int argc, const char * argv[])
{
    /* Define temporary variables */
    double value1, value2;
    double result;

    /* Assign the values we will use for the pow calculation */
    value1 = 4;
    value2 = 2;

    /* Calculate the result of value1 raised to the power of value2 */
    result = pow(value1, value2);

    /* Display the result of the calculation */
    printf("%f raised to the power of %f is %f\n", value1, value2, result);

    return 0;
}

When compiled and run, this utility will output:

4.000000 raised to the power of 2.000000 is 16.000000

Similar Functions

Other C functions that are similar to the pow function:

exp feature log characteristic log10 function sqrt characteristic