- pow( ) function in C is used to find the power of the given number.
- ”math.h” header file supports pow( ) function in C language. Syntax for pow( ) function in C is given below.
double pow (double base, double exponent);
Example program for pow() function in C:
#include <stdio.h> #include <math.h> int main() { printf ("2 power 4 = %f\n", pow (2.0, 4.0) ); printf ("5 power 3 = %f\n", pow (5, 3) ); return 0; }
Output:
2 power 4 = 16.000000 5 power 3 = 125.000000 |
0 comments:
Post a Comment