Table of Content

pow() Function : C Reference

Calculating x^n Using Pow function :


int main()
    int num,power,result;

    printf("\nEnter the numaber and its Power : ");

    result = pow(num,power);
    printf("\nResult : %d",result);


Output :

Enter the numaber and its Power : 6 2
Result : 36

Explanation of the Code :

  1. In a C Programming Language we can find the expression of type “x raise to y”.
  2. Power function is used to find the square , cube of number or number raise to any index.
  3. math.h header file contain the power function.

Syntax of the Pow Function :


represents num1 raise to num2.

Different Ways of Using Power Function :

Way 1 : Used to Find Cube

result = pow(num,3);

Way 2 : Used to Find Square

result = pow(num,2);