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?

angryTom
angryTom Original
2020-02-26 10:51:31 20149browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn