Home>Article>Backend Development> What is the function to find the nth power of x in C language?
#What is the function to find the nth power of x in C language
C languagepow()function is used Find the value of x raised to the power of y.
Header file: math.h
Syntax/Prototype:
double pow(double x,double y);
Parameter description:
x: Double precision number.
y: Double precision number.
Return value: the value of x raised to the power of y.
Recommended learning:c language video tutorial
Usage example:
Use the pow() function to find 6 times of 4 Square, the code is as follows:
#include#include int main() { double x = 4, y = 6; //为变量赋初值 double result = pow(x, y); //求a的b次方 printf("%lf\n", result); return 0; }
Running results:
4096.000000
php Chinese website, a large number ofIntroduction to Programmingtutorials, welcome to learn!
The above is the detailed content of What is the function to find the nth power of x in C language?. For more information, please follow other related articles on the PHP Chinese website!