pTutorial

New way to learn C programming

C pow function

Math.h: pow is a c math library function which is used to calculate the power of the first number to the second number. Suppose if you want to calculate 2 to power 5 then pass 2 as a first argument and 5 as a second argument.

C pow function example

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
  double x, y, num;
 
  printf("Enter x and y to calculate x power y\n");
  scanf("%lf%lf", &x, &y);
 
  num = pow(x, y);
 
  printf("%lf raised to %lf = %.2lf\n", x, y, num);
  
  getch();
 
}

Download Pow function example

Output of program

Pow function example

See Also

Jquery dynamic form example.php   |   C program to count number of digits in a number   |   Java string array example

QUOTES OF THE DAY

Goal is tired by fire, brave men by adversity.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER