How to use pow() function to calculate a value of base raised to the power exponent in C

1 Answer

0 votes
#include <stdio.h>     
#include <math.h> 
 
int main(int argc, char **argv)
{   
	printf("pow(5.0, 3.0) = %f\n", pow(5.0, 3.0));
	printf("pow(3.14, 10.0) = %f\n", pow(3.14, 10.0));
	printf("pow(31.15, 1.43) = %f\n", pow(31.15, 1.43));
	printf("pow(4, 0.5) = %f\n", pow(4, 0.5));
    printf("pow(-3, -2) = %f\n", pow(-3, -2));
  
    return 0;
}
 
/*
run:
   
pow(5.0, 3.0) = 125.000000
pow(3.14, 10.0) = 93174.373387
pow(31.15, 1.43) = 136.661132
pow(4, 0.5) = 2.000000
pow(-3, -2) = 0.111111

*/

 



answered Mar 28, 2016 by avibootz
...